Arc Forumnew | comments | leaders | submitlogin
1 point by aw 5114 days ago | link | parent

My http://awwx.ws/table-vivifier patch sounds like it may be close to what you want, though it goes too far: it extends tables so that if a key isn't found in the table, it calls a specified function to generate the value -- and then inserts the new value in the table.

If it would be useful, I could simplify it to leave off the last part, and then you could specify the action to take if the key isn't found (such as looking it up in a parent, for example).



1 point by Pauan 5114 days ago | link

Pretty cool. But with my proposal, you could write that in Arc itself.

My solution is general... it works on all compound data types: tables, input, lists, etc.

Imagine being able to write cons, car, cdr, instring, peekc, readc, and more, all in Arc! It drastically cuts down on the number of primitives Arc needs.

-----