
No, Racket preserves source location for syntax constants. Many versions ago, it didn’t. If you have syntax properties you want to persist across compilation, make sure they are preserved syntax properties.

@robby To bounce a handy-wavy idea off you: Could the contract system, when provide
-ing a wrapper with some synthesized name, set a syntax property with the identifier of the thing being wrapped? So that things like drracket/check-syntax could give that identifier to identifier-binding
(making jump-to-definition work in more cases)?

Yes, the contract system can cooperate with some protocol to help people jump from references to definitions past the contract.

I’ve found that, in the past, however, that jumping to the contract-out
and then jumping from there to the actual definition is useful.

(I didn’t follow this conversation tho)

Thank you!

I want racket foo.rkt
to have a regular behavior, but racket runner.rkt foo.rkt
to run foo.rkt
with a behavior of a macro modified. How can I do that?
Here are what I tried (and failed):
Define a syntax parameter which is initially
#f
. In the macro, usesyntax-parameter-value
to check if the parameter is#t
or#f
and rewrite accordingly. Inrunner.rkt
,(syntax-parameterize ([... #t]) (dynamic-require the-file #f))
Define a parameter at phase 1 which is initially
#f
. Inrunner.rkt
’s phase 1, set the parameter to#t
. In phase 0,(dynamic-require the-file #f)
.
In both approaches, the {parameter, syntax-parameter} is always #f
in the macro, even when running via runner.rkt
.

I think I would use subprocess instead of dynamic-require. In doing so, add different flags to run foo.rkt
, like foo.rkt --mode1
or foo.rkt --mode2
. In the runner.rkt, I would be able to run foo.rkt with subprocess
in the specific mode

Thanks. Will use this approach if there’s no better solution. One problem with this approach is that foo.rkt
might need to parse command line argument, and it would be difficult to design these “meta flags” in a way that doesn’t conflict with the actual flags.

(the same argument applies to subprocess
+ environment variable, but I guess environment variable might be a little more flexible)

That seemed to do it, thank you. I would not have figured that one out easily

If you control the language of foo.rkt
, then I’d have the expansion of foo.rkt
generate two modules: the main module with the default-expansion binding of the macro, and a submodule for the alternate macro binding. Then, runner.rkt
can load the submodule.

I figured it out by comparing the docs for eval
and eval-syntax
. One difference is that eval
“enriches” the syntax object and eval-syntax
doesn’t. Part of the puzzle is namespace-syntax-introduce
.

I ended up stumbling on https://stackoverflow.com/questions/32061267/difference-between-eval-and-eval-syntax#32066856 (You were there in 2015!) I still don’t understand what it means for namespace-syntax-introduce
to override top-level lexical information. Can I get more specifics?

Hello, living inside parens fellas, quick question, I just found this Clojure to Scheme library: https://github.com/wvdlaan/clojure-scheme\|https://github.com/wvdlaan/clojure-scheme and I wanted to know if anybody knows about something similar but for Scala (yes, you read right, Scala :smile:)


Odd place to ask…

So, I just should use Dotty AST and generate racket code, right?

Note that the link goes to a specific section - slack is showing the wrong one.

I think the odds for a nice answer is better in a Scala slack :slightly_smiling_face:

Then, my Initial question mentioned: Clojure to Scheme, now I question if somebody knows about Scala to Scheme

I can’t ask Scala devs they do not know about Scheme

Not all of them, off course, but I will ask anyways. Thanks @soegaard2

Well you’d be surprised. Noel Welsh for one is an old Schemer.

Off course, I was talking about avg. Scala dev (I am one of those) and I do know programming gods walk amongs us, :smile:

If I wanted to create a logger that took structured messages (ex: hasheq?
) instead of string?
would I essentially need to roll my own logging system from scratch or is there a way to wrap log-message
(https://docs.racket-lang.org/reference/logging.html?q=logging#%28def._%28%28quote._~23~25kernel%29._log-message%29%29) and friends?

Can’t you just use the data argument to log-message?