Allow method-calls on objects.
skx opened this issue · 0 comments
skx commented
I suspect I went down the wrong-path when I started adding the abliity to run things like this:
puts( strings.toupper( "steve" ) );
The idea of a standard-library is appealing, but really when we want to turn a string into a modified version we should probably allow that to happen via the object itself. So I'd prefer users to write:
puts( "steve".toupper() );
Of course not everything is an object, but a similar approach could be applied to at least:
- arrays
- hashes
- strings
Integers/Floats/Booleans will probably be left alone, and we'd keep the "standard library" for files/etc.
This will be a reasonably large change:
- Allow parsing method-calls via a "."
- e.g. "foo.bar()" is a method call to function "bar" with implicit arg "foo".
- Remove much of the standard library.
- e.g. strings.toupper, strings.tolower(), etc.
Fun times :)