|
List Info
Thread: A smorgasbord of newbie questions about docs, modules and zip compression
|
|
| A smorgasbord of newbie questions about
docs, modules and zip compression |

|
2006-02-14 16:37:01 |
|
That makes sense, and the syntax of using a chain of protos is
intuitive, one can easily grasp the hierarchy.
But let's say you are writing some Io code that will run some
arbitrary code written by another Io master, how do you prevent name
collisions in that case? You always load each set of code in it's own
slot in your main object?
On Feb 13, 2006, at 10:02 PM, John Nowak wrote:
>
> On Feb 14, 2006, at 12:39 AM, John Clayton wrote:
>
>> Ok, while I have you, let me take advantage. A couple of quick
>> questions about form,
>>
>> * Given the behavior of Importer, do you generally define one
>> proto per file?
>
> I don't, and I'd suspect most people don't. I generally write a lot
> of small protos (in contrast to a few big classes), so I tend to
> group multiple protos into one file by function.
>
>> * Do you add prefixes the proto/file names ala Obj-C to prevent
>> name collisions?
>
> I generally don't. In Io, you can point to an object from anywhere,
> not just via the Lobby. You can add slots in protos and have those
> point to protos, or use a map, et cetera. Rather than use prefixes,
> I tend to use maps and protos as namespaces. Which one to use
> depends on the task at hand. I normally only use maps when I want
> to have more than one hundred slots within one object, which is a
> bad things to do for efficiency reasons.
>
> Just a quick example or two:
>
> FooObjects := Object clone
> FooObjects FooOne := Object clone do (
> method1 := method(...)
> method2 := method(...)
> )
>
> FooObject FooOne method1
>
> ---------
>
> M := Map clone do (
> atPut("Foo", Object clone do(
> method1 := method(...)
> ...
> ))
> )
>
> M at("Foo") method1
>
> ---------
>
> - John
|
[1]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|