-
-
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
Object literals should use values from scope when using short syntax #237
Comments
this works now: (let ((foo 10) (bar 20))
(object :foo :bar)) But Need to investigate. |
That's right there is a bit of inconsistency here: lips> (lips.parse "&(:foo 10)")
#(&(:foo 10))
lips> (lips.parse "`(foo bar)")
#((quasiquote (foo bar))) The first expression should evaluate into: #((object-literal :foo 10)) To solve this issue default syntax extensions should be just simple mappers: (define (object-literal-map x)
`(object-literal ,@x))
(set-special! "&" 'object-literal-map)
(let ((foo 10)) &(:foo))
;; ==> &(:foo 10) Real macros can be left to reader macros tracked in #150 |
This breaks tests and because of this object literals don't work anymore as vectors: (let ((x 10)) `&(:foo ,x))
;; ==> (object-literal :foo 10) (let ((x 10)) `#(1 2 ,x))
;; ==> #(1 2 10) but now object literals works as a quotation: `'(foo)
;; ==> (quote (foo)) I think that it will be better to update tests. |
Found old commented-out unit tests that define how this should work, so restored the old behavior: lips> (let ((foo 10) (bar 20)) &(:foo :bar))
&(:foo #<undefined> :bar #<undefined>) But also added read-only properties. The below code will throw an error: (let ((x &(:foo :bar 10)))
(set! x.bar 20)) |
According to the documentation:
this should reutnr
&(:foo 10 :bar 20)
Another issue is that prism highlighting doesn't support shorthand syntax.
The text was updated successfully, but these errors were encountered: