Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text representation for user-defined types #15

Open
fleabitdev opened this issue Aug 16, 2020 · 0 comments
Open

Text representation for user-defined types #15

fleabitdev opened this issue Aug 16, 2020 · 0 comments

Comments

@fleabitdev
Copy link
Owner

One of my goals for GameLisp is to allow the programmer to sacrifice performance in exchange for extreme customisation. For example, it should eventually be possible for a custom iterator library to redefine functions like iter, iter-next! and iter-finished?.

Today, GameLisp's parser and printer are conspicuously non-customisable. They support a handful of primitive types, and nothing else.

This makes user-defined obj and rdata types less powerful than they ought to be. Fundamental types like BigInt and Point can't be serialized to a file, read in from a file, quoted, written as a self-evaluating literal (like #((a b)) for tables), or used as a macro's argument or return value.

The most general solution would be to make the parser fully customisable. This would enable the programmer to create their own literal syntax for each type, e.g. 0n1234 for a BigInt.

A simpler solution would be to provide function-invocation syntax for the parser. The text #(Point 0 0) would cause the parser to invoke the parser function which has been registered to the symbol Point, interleaving its return value into the parsed output.

Both of those options would be inelegant in their own way, so the third option would be to leave this issue as WONTFIX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant