Re: [racket-users] How to setup the #%module-begin form with the type-expander lib or #lang typed/racket ?

2019-04-15 Thread Matthew Butterick
`read-syntax` is special, because its job is to convert the surface notation of 
a #lang into S-expressions. So whatever is happening in `read-syntax` is 
happening during compile time, even if we're using functions rather than 
macros. In general, the reader is the most idiosyncratic part of the #lang 
processing pipeline (though perhaps this stands to reason, as surface notations 
are likewise idiosyncratic)


> On Apr 15, 2019, at 2:59 PM, Raoul Schorer  wrote:
> 
> However, I am confused because my lexer (using parser-tools) and pre-expander 
> are defined as standard functions. So in fact, they execute only once at run 
> time, at the difference of a language implemented only with macros which 
> would then have a clear compile time/run time distinction. I would have 
> expected that writing a racket DSL would involve doing almost everything with 
> macros, so is this way of doing things suboptimal?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] How to setup the #%module-begin form with the type-expander lib or #lang typed/racket ?

2019-04-15 Thread Raoul Schorer
Thank you for your answer , it does not really solve my general problem (I 
think), but it enabled progress. I changed my read-syntax to:
(define (read-syntax _ port)
  (define semi-ast (lex/j port))
  (define module-datum `(module mod/j typed/racket (,@(pre-expand 
semi-ast
  (datum->syntax #f module-datum))

So I am currently just attempting to compile to typed/racket syntax in a 
preparatory step, and then simply reuse the typed/racket expander. However, 
I am confused because my lexer (using parser-tools) and pre-expander are 
defined as standard functions. So in fact, they execute only once at run 
time, at the difference of a language implemented only with macros which 
would then have a clear compile time/run time distinction. I would have 
expected that writing a racket DSL would involve doing almost everything 
with macros, so is this way of doing things suboptimal?

Le lundi 15 avril 2019 19:49:56 UTC+2, Matthew Butterick a écrit :
>
>
>
> On Apr 12, 2019, at 6:00 PM, Raoul Schorer  > wrote:
>
> Is there a way to achieve expansion to typed/racket from my custom 
> language, please?
>
>
> With the caveat that I'm probably overlooking some wrinkle pertaining to 
> Typed Racket — in general, the language of the expander module doesn't need 
> to be same as the language of the `#%module-begin`. I have used this 
> pattern before successfully. I don't know if this solves your problem in 
> the large. But it makes your toy example work.
>
>
> ;; expander.rkt
> #lang racket
> (require (prefix-in tr: (only-in typed/racket #%module-begin)))
> (provide (rename-out [module-begin/j #%module-begin]))
> (define-syntax (module-begin/j stx)
>   (syntax-case stx ()
> [(_ a) #`(tr:#%module-begin 2)]))
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Program aborts except when there are no previously compiled .zo files

2019-04-15 Thread Dmitry Pavlov



It would be good if you can share a link to the code. It is difficult to 
guess where is the problem is with this information. Is there an online 
public repository with the code?


Unfortunately, no. But you are right. I will try and provide an
excerpt on which the crash reproduces.

Best regards,

Dmitry

--
You received this message because you are subscribed to the Google Groups "Racket 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] How to setup the #%module-begin form with the type-expander lib or #lang typed/racket ?

2019-04-15 Thread Matthew Butterick


> On Apr 12, 2019, at 6:00 PM, Raoul Schorer  wrote:
> 
> Is there a way to achieve expansion to typed/racket from my custom language, 
> please?


With the caveat that I'm probably overlooking some wrinkle pertaining to Typed 
Racket — in general, the language of the expander module doesn't need to be 
same as the language of the `#%module-begin`. I have used this pattern before 
successfully. I don't know if this solves your problem in the large. But it 
makes your toy example work.


;; expander.rkt
#lang racket
(require (prefix-in tr: (only-in typed/racket #%module-begin)))
(provide (rename-out [module-begin/j #%module-begin]))
(define-syntax (module-begin/j stx)
  (syntax-case stx ()
[(_ a) #`(tr:#%module-begin 2)]))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] vi-mode for racket cli

2019-04-15 Thread Marc Kaufmann
Fantastic, that was faster and easier than I thought! So nice to not
constantly mess up all my commands any more... A good start to a new week.
:-)

Cheers,
Marc

On Mon, Apr 15, 2019 at 10:51 AM Marc Kaufmann 
wrote:

> Ha, thanks. I should have searched the docs for readline, not for vi-mode
> and vi mode. I'll let you know how it goes.
>
> Marc
>
> On Mon, Apr 15, 2019 at 10:30 AM Tom Gillespie  wrote:
>
>> I'm not sure if this will fix your vi-mode issues, but here is some info
>> on the readline situation. You should be able to get readline support by
>> installing readline-gpl via `raco pkg install readline-gpl` (as the name
>> suggests it was removed from core racket due to gpl compatibility
>> concerns).  Some additional info in the docs
>> , with an additional
>> note that `racket -il xrepl` is another way to start racket with readline
>> support (once you have readline-gpl installed). Best!
>> Tom
>>
>>
>> On Mon, Apr 15, 2019 at 1:20 AM Marc Kaufmann 
>> wrote:
>>
>>> Hi all,
>>>
>>> I use vi-mode in the cli and in all the repls that use readline.
>>> Racket's repl does not use readline for reading. Is there a way to get
>>> vi-mode going anyway, either by wrapping readline around first or something
>>> else? And if it's possible, would this require switching off something else
>>> that is really important to have in the REPL?
>>>
>>> I hope someone else figured this one out before.
>>>
>>> Cheers,
>>> Marc
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Racket Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to racket-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] vi-mode for racket cli

2019-04-15 Thread Marc Kaufmann
Ha, thanks. I should have searched the docs for readline, not for vi-mode
and vi mode. I'll let you know how it goes.

Marc

On Mon, Apr 15, 2019 at 10:30 AM Tom Gillespie  wrote:

> I'm not sure if this will fix your vi-mode issues, but here is some info
> on the readline situation. You should be able to get readline support by
> installing readline-gpl via `raco pkg install readline-gpl` (as the name
> suggests it was removed from core racket due to gpl compatibility
> concerns).  Some additional info in the docs
> , with an additional
> note that `racket -il xrepl` is another way to start racket with readline
> support (once you have readline-gpl installed). Best!
> Tom
>
>
> On Mon, Apr 15, 2019 at 1:20 AM Marc Kaufmann 
> wrote:
>
>> Hi all,
>>
>> I use vi-mode in the cli and in all the repls that use readline. Racket's
>> repl does not use readline for reading. Is there a way to get vi-mode going
>> anyway, either by wrapping readline around first or something else? And if
>> it's possible, would this require switching off something else that is
>> really important to have in the REPL?
>>
>> I hope someone else figured this one out before.
>>
>> Cheers,
>> Marc
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] vi-mode for racket cli

2019-04-15 Thread Tom Gillespie
I'm not sure if this will fix your vi-mode issues, but here is some info on
the readline situation. You should be able to get readline support by
installing readline-gpl via `raco pkg install readline-gpl` (as the name
suggests it was removed from core racket due to gpl compatibility
concerns).  Some additional info in the docs
, with an additional note
that `racket -il xrepl` is another way to start racket with readline
support (once you have readline-gpl installed). Best!
Tom


On Mon, Apr 15, 2019 at 1:20 AM Marc Kaufmann 
wrote:

> Hi all,
>
> I use vi-mode in the cli and in all the repls that use readline. Racket's
> repl does not use readline for reading. Is there a way to get vi-mode going
> anyway, either by wrapping readline around first or something else? And if
> it's possible, would this require switching off something else that is
> really important to have in the REPL?
>
> I hope someone else figured this one out before.
>
> Cheers,
> Marc
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] vi-mode for racket cli

2019-04-15 Thread Marc Kaufmann
Hi all,

I use vi-mode in the cli and in all the repls that use readline. Racket's 
repl does not use readline for reading. Is there a way to get vi-mode going 
anyway, either by wrapping readline around first or something else? And if 
it's possible, would this require switching off something else that is 
really important to have in the REPL?

I hope someone else figured this one out before.

Cheers,
Marc

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.