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

Error traces now point within .arc files #151

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shawwn
Copy link
Member

@shawwn shawwn commented Jan 29, 2019

arc> ((fns* '5GFZ8DW8A8) 'asdf)
Can't coerce  asdf fn
  context...:
   ./anarki/ac.rkt:1182:0: ar-coerce
   ./anarki/lib/app.arc:35:0:  get-user
   ./anarki/lib/app.arc:149:0:  login-handler
   ./anarki/ac.rkt:1435:4

Copy link
Member

@rocketnia rocketnia left a 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)
Copy link
Member

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)))
Copy link
Member

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)))
Copy link
Member

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)))))
Copy link
Member

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?

Copy link
Member

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."
Copy link
Member

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))))))

Copy link
Member

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) ...).

@shawwn shawwn mentioned this pull request Feb 6, 2019
@rocketnia
Copy link
Member

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 anarki-init system so you were aware of them into the future.

@shawwn
Copy link
Member Author

shawwn commented Feb 6, 2019

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.

@shawwn
Copy link
Member Author

shawwn commented Feb 6, 2019

@rocketnia By the way, if you want to chat in realtime: https://discord.gg/qaqkc9z

Are you in any slack channels or IRC?

@rocketnia
Copy link
Member

@kennethrapp Thanks for the attention to this issue!

There's a build error at the moment.... I guess like the import of syntax/stx was necessary in order to get the function stx->list.

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

Successfully merging this pull request may close these issues.

None yet

3 participants