Re: [phix] How does namespacing work?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Phix is not very good at overloading. Currently when it sees "map", it thinks "oh good, the type map", if we added "namespace map" then it would think "oh good, the namespace map, now where's the colon?" (and barf on the "map x = new()"). It is the overloading, trying to use "map" for two different things, that it struggles with. However, this works fine:

include builtins/map.e as m 
   
map x = new()   
put( x, "one",  1000 )   
? m:get(x, "one" )   

Of course instead of "as m" you could put "namespace m" inside/at the start of map.e.

This is clearly fixable, as you could deduce from the [absence of a] trailing ":" whether a namespace or something else was intended, not that I have any immediate plans or any idea how long it might take, plus:

Two or three years ago I took the decision to prohibit builtin overrides in Phix, which is another form of overloading: it caused several problems which were just too difficult to fix, and I have never looked back from that decision.

Pete

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu