Talk:Ans

From Esolang
Jump to: navigation, search

I am currently trying to decide something. I want to be able to create lists in the language, and I was thinking of using [] or () for the list. Every top level function call (excluding `,B,\,@ maybe) would be evaluated and become one item in the list. I want to know if this sounds good and if [] or () should be used.

In addition, I would like to be able to add Object Oriented support eventually. I was thinking of using capitalized names (like functions) for the classes, and using : as the "dot" operator. Either functions or variables could be specified after the colon. Static methods/variables could be used by putting a colon after the name of the class, and normal methods/variables by placing a colon after a variable that has been instantiated by the class constructor. However, I am not sure how I want to define the classes and how to specify a constructor/destructor. One such method for this follows: (Init is the constructor)

Class Foo
Func Foo:Init 1
    `S _me:_v _a
Func Foo:Test 1
    `# + _me:_v _a

S _foo Foo:Init 3
_foo:Test 4

Which should print 7 when run. Here, _me is used as the this reference. Using private variables is something that needs to be worked out, but _hidden or similar might be used. Please tell me what you think of this. --Revcompgeek 14:12, 23 April 2008 (UTC)

I vote for () for list literals, and vote against adding classes. Not every list-based language needs to look like CLISP. How about adding a built-in deep copy function and the ability for closures (trees) to introspect the lists in which they are stored instead? Basically a user creates a cons where the head is a list of fields, and the tail is a list of closures (what you call trees) where the closures pull in the fields as arguments as needed by introspection. Instantiating a new one would just be a matter of deep copying the prototype, then modifying it as needed. This would be very similar to having objects as long as you can have associative lists so that you can add keys (names) to elements in a list. --Quintopia 04:39, 25 March 2009 (UTC)

Thanks for the feedback. I don't think I'm going to have introspection, but I think I'm going to add global variables (each function is restricted to variables in its own scope at the moment) and associative arrays. --Revcompgeek 18:55, 25 March 2009 (UTC)