Re: named array

new topic     » goto parent     » topic index » view thread      » older message » newer message
jimcbrown said...
TheresNoTime said...

The disadvantage is that it will lead to the need to monitor changes of consistency and make clones. But it will be much easier.

Your library has the same disadvantage of the necessity of making clones, whether you realize it or not.

I was talking about something else. I do not care what goes on behind the scenes. The problem is that if you use the maps, you will have to do clones manually. My approach - always make clones, even if they are not needed. This is inefficient, but it can be optimized. Here's how it might look from the outside

narr Local -- Auxiliary variable, to allude it every time when you call a function put() or get(). 
 
function playWithNarr(narr External) 
Local = External 
put("velocity:152.35 coordinates:458,490,3047 name:Ball") -- equivalent to tree puts: atom, sequence of integers and sequence "Ball"! 
sequence Data = get("acceleration color") -- equivalent to two gets! But I got carried away. This particular improvement doesn't make any sense. :) 
-- Ahh! But now would be a very useful thing! Universal function, that able to recognize, what I want: put or get. 
Local = x("velocity:152.35 coordinates:458,490,3047 name:Ball") 
Acceleration = x("acceleration") 

I'm starting to wonder ... May be, simply use the language, which already has something like this? For example, Ruby? Python has not something similar to Ruby's symbols. Python's dict is equivalent of Euphoria's map, but Python has very useful syntax sugar for it. So, it seems equivalent to Ruby's symbols.

said...

Agreed - a mutable map type (like the one in Euphoria) has a lot more functionality.

In my particular case, this functionality is not only superfluous but also harmful.

said...

If I understand correctly, your preprocessor example would be, though. I agree that, for stylistic reasons, that would be the better approach. Adding a new literal symbol type should be done by adding a new literal symbol type, with syntax sugar and all, not by faking it with arrays and strings or maps.

This is my dream. Do you agree, that Euphoria's syntax is overloaded a bit? It would be great to create something, that would be the same for Euphoria, what was CoffeeScript for JavaScript. I propose to call it Kaif. This is an Arabic word meaning pleasant, relaxed pastime with coffee and tobacco. :)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu