Arc Forumnew | comments | leaders | submitlogin
3 points by sacado 6064 days ago | link | parent

If you implement your objects like hash tables (the way it is done in Lua, Javascript, Perl or -- secretly -- in Python), you can easily implement anything you need, including duck typing and inheritance : http://arclanguage.com/item?id=3155.

But not strong encapsulation, sorry. This can be done with closures however, if you really need it (but I don't think Arc is the right language if you want to constrain the developer at all).

You can also make any function doing dynamic dispatch based on the type of objects. For example, you can redefine the + function to perform a special operation when called with a foo object as a parameter, or behave the usual way in the other cases. That's a method-calling mechanism (even more powerful actually). Use any object representation you need (hash table, list, cons cell, integer, ...) and 'annotate, and you're done !