Arc Forumnew | comments | leaders | submitlogin
Redefining built-ins
5 points by etfb 6119 days ago | 1 comment
From the tutorial:

I called it mylen because there's already a function called len for this. You're welcome to redefine Arc functions, but redefining len this way might break code that depended on it, because len works on more than lists.

Does this mean that if, say, (while ...) was defined within Arc as using (if ...), and I redefined if for my own evil purposes, it would change how while worked as well? In other words, does redefining replace, or merely append? I'm thinking in Forth terms perhaps -- if you redefine a word in Forth, it doesn't retroactively change all compiled uses of the word, because it just adds it to the end of the dictionary -- but since dictionary lookups start at the end, every new usage of that word will find your new version. Is Arc like that? For that matter, is Lisp?



1 point by randallsquared 6118 days ago | link

Yes, it would change how while worked. This is the major reason why a module system is very important, stat. :)

-----