-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Allow shorthand object literals #185
Comments
It seems this is impossible to do. Because The only thing that can be done is to allow undefined values, it probably is only useful with |
Now shorthand object literals are never read-only: (let ((obj &(:x :y)))
(set! obj.x 10)
(set! obj.y 20)
obj) |
There is one problematic unit test: (test "core: it should throw when change object literals long property after short property"
(lambda (t)
(let ((obj &(:x :y 20)))
(set! obj.x 10)
(t.is (to.throw (set! obj.y 30)) true)
(t.is obj &(:x 10 :y 20))))) if the first property is short the object is not frozen so you can still modify the second property. Maybe it's worth making read-only properties instead of the whole objects. |
It would be nice to be able to use syntax like this:
It may require a bit of work because right now
object-expander
usespair-map
that iterate over pairs and check if they arekey?
symbols. There is a need for a more general iteration that is key? aware and skip if there are no values.This will be important to implement a complex
let-bind
macro ##184.The text was updated successfully, but these errors were encountered: