-
Notifications
You must be signed in to change notification settings - Fork 160
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
Error traces now point within .arc files #151
base: master
Are you sure you want to change the base?
Conversation
shawwn
commented
Jan 29, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some parts of this surprise me enough that I've gone and done a point-by-point review for once. XD Generally (and personally), I don't think I have strong objections to merging to master, and the overall effect of the changes is worth whatever's lost here.
ac.rkt
Outdated
@@ -103,17 +104,47 @@ | |||
([anarki-init-in-main-namespace-func anarki-init-verbose]) | |||
(anarki-init-in-main-namespace))) | |||
|
|||
|
|||
(print-hash-table #t) | |||
(print-syntax-width 10000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use global state in the ac.rkt module. All the initialization steps should be possible to run multiple times by calling anarki-init
, preferably with some way for Racket code to keep the settings of different instances isolated from each other.
ac.rkt
Outdated
(let ((s (syn x))) | ||
(syntax->datum s))) | ||
|
||
(define env* (make-parameter (list))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please allocate global stateful objects like this by using an xdef
so it's carried in the Arc namespace and initialized by anarki-init
. That way Racket code can pass around multiple instances of Anarki by passing around their namespaces.
ac.rkt
Outdated
((eqv? a 'null) (err "Can't rebind null")) | ||
((lex? a env) `(set! ,a ,n)) | ||
[(ac-defined-var? a) `(,(ac-global-name a) ,n)] | ||
(#t `(set! ,(ac-global-name a) ,n))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put the square brackets back here? Or if there was a reason you changed them, why did you leave one pair?
(compile racket-expr)))) | ||
(if (syntax? racket-expr) | ||
(compile-syntax (namespace-syntax-introduce racket-expr)) | ||
(compile racket-expr))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda love seeing this branch for some reason. At first it seemed to clarify a lot about your approach. But as I think about it, what if the expression starts off with a non-syntax list and then has syntax objects inside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I got all kinds of context mixed up here. This is the Racket compile
and compile-syntax
. XD
@@ -1557,17 +1557,17 @@ read from the stream 'str'." | |||
(tostring ,@body) | |||
,dest)) | |||
|
|||
(def readstring1 (s) | |||
(def readstring1 (s (o data t)) | |||
"Reads a single expression from string 's'. Returns the uninterned symbol | |||
stored as the global value of 'eof' if there's nothing left to read." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not that this is directly related to this change, but you've changed eof recently, right? I know you make the type of a bunch of things 'sym
, which surprises me but not in a way I can really quantify, and I've been meaning to ask how you think of symbols as a concept.
(expr (ac* s e env))) | ||
(parameterize ((current-namespace ns)) | ||
(namespace-syntax-introduce (syn expr stx)))))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gosh, this is where the magic happens, isn't it? A well-placed namespace-syntax-introduce
.
I just noticed you call (ac* s e env)
here, but ac*
is defined by (defarc (ac* e s env) ...)
.
Heya @shawwn, I hope my comments on this haven't dissuaded you from merging. Most of 'em can be fixed later. I just wanted to express some factors like the Racket square bracket style and the |
Nah, your comments were spot-on. I just haven't had time to address them yet. I added you as a collaborator to my fork of anarki; feel free to fix up some of these issues if you'd like. |
@rocketnia By the way, if you want to chat in realtime: https://discord.gg/qaqkc9z Are you in any slack channels or IRC? |
@kennethrapp Thanks for the attention to this issue! There's a build error at the moment.... I guess like the import of |