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

Add a dialect for using immutable data types? #5

Open
darrencruse opened this issue Dec 3, 2015 · 0 comments
Open

Add a dialect for using immutable data types? #5

darrencruse opened this issue Dec 3, 2015 · 0 comments

Comments

@darrencruse
Copy link
Owner

Immutable data types might be esp. of help for the html dialect for data binding in the spirit of React/Om where you can tell if something's changed very easily.

see e.g. http://jlongster.com/Using-Immutable-Data-Structures-in-JavaScript

Not that SugarLisp isn't trying to be a clojure or an Elm etc. so I think it's good this would be optional.

But possibly there's a nice way to support them as a dialect? Something like (in SugarScript):

#use "html"
#use "immutable"

val boundval;
var input = <h2>${boundval}</h2>;
boundval = if? (new Date().getHours() > 11) "good afternoon" else "good morning";

Note the keyword "val" for an immutable value.

The goal here would be to generate the code needed for one of these immutable libraries for get/set expressions using a "val" variable, but letting the sugarlisp programmer use normal javascript-y syntax.

(I need to look closer at these libraries but James Long's post above hints that most immutable libraries have special requirements i.e. something like "immutable.set(x, 10)" not just "x = 10")

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

No branches or pull requests

1 participant