chenhsi / Ambroscum

An interpreter/compiler for a programming language we're probably going to create
MIT License
0 stars 0 forks source link

Built-in functions #23

Closed edgao closed 2 years ago

edgao commented 10 years ago

Things that would be useful: (names are definitely not set in stone)

Related: is instanceof going to be a keyword or a function?

chenhsi commented 10 years ago

I think that some of this (specifically, the math ones) shouldn't necessarily be hard-coded into the language, but can simply be implemented in some .ambr file that is auto-included in execution? An "import file" system seems quite necessary (when such a statement is seen, find that file and execute all lines in that file?)

Others, however, like str_to_int, are more reasonably features that can be built into the language. Regarding substring and insert, I'm quite fond of Python's slicing syntax, and I'm also fond of how Python directly treats strings as immutable lists.

Instanceof is unlikely to be either a keyword or a function, if there aren't going to be classes.

edgao commented 10 years ago

That's pretty much what I was thinking - something like auto-include "import ambroscum.lang" at the top of every script.

I will agree that slicing is pretty awesome, and the idea of Strings as lists is fine with me.

In terms of instanceof, I was thinking of implementing some way to check if an object had certain fields (or, to check if one object had all of the fields of another). For example, some_object.hasField("iterator"), or some_object.implements(other_object).

edgao commented 2 years ago

closing this because I want to clean out my issues view and I think we've basically abandoned this lol