Re: [racket] Defining a typed language

2014-11-03 Thread E. Moran
On Mon, Oct 27, 2014 at 05:43:38AM -0400, Alexander D. Knauth wrote: > So it didn’t work if (require a-typed-lang/more) was in > a-typed-lang/main.rkt, it didn’t work, but commenting that out made it > work again. > > Does anyone know what’s happening here? That'd happen in my version, too, if a

Re: [racket] Defining a typed language

2014-11-01 Thread Konrad Hinsen
Sam Tobin-Hochstadt writes: > You can't turn this feature off -- it's a fundamental part of the > macro system. There are a few strategies that you can employ here: > > 1. If your language is written with #lang, then you can insert, at > `read` time, an extra form, perhaps just `(begin)`. Th

Re: [racket] Defining a typed language

2014-10-31 Thread Sam Tobin-Hochstadt
On Fri, Oct 31, 2014 at 5:57 AM, Konrad Hinsen wrote: > Sam Tobin-Hochstadt writes: > > > The rule is that for anything like: > > > > (module m lang > > (form ...)) > > > > `form` is expanded until it either produces `#%plain-module-begin` or > > another core form. In the former case, it

Re: [racket] Defining a typed language

2014-10-31 Thread Konrad Hinsen
Sam Tobin-Hochstadt writes: > The rule is that for anything like: > > (module m lang > (form ...)) > > `form` is expanded until it either produces `#%plain-module-begin` or > another core form. In the former case, it just continues, in the > latter case, it wraps the whole thing with `

Re: [racket] Defining a typed language

2014-10-30 Thread Sam Tobin-Hochstadt
On Wed, Oct 29, 2014 at 5:50 AM, Konrad Hinsen wrote: > Sam Tobin-Hochstadt writes: > > > > This suggests that if I want my single-form module to be handled exactly > > > like a multi-form module, my single form must expand to something else > > > than #%plain-module-begin. Fine. But who or wha

Re: [racket] Defining a typed language

2014-10-29 Thread Konrad Hinsen
Sam Tobin-Hochstadt writes: > > This suggests that if I want my single-form module to be handled exactly > > like a multi-form module, my single form must expand to something else > > than #%plain-module-begin. Fine. But who or what decides what my single > > form becomes when it is "partially

Re: [racket] Defining a typed language

2014-10-28 Thread Sam Tobin-Hochstadt
On Tue, Oct 28, 2014 at 10:30 AM, Konrad Hinsen wrote: > Konrad Hinsen writes: > > > I have added lots of comments to my minimalistic typed language > > implementation, in the hope that future language definers will > > be able to pick up from there: > > > >http://github.com/khinsen/racke

Re: [racket] Defining a typed language

2014-10-28 Thread Konrad Hinsen
Konrad Hinsen writes: > I have added lots of comments to my minimalistic typed language > implementation, in the hope that future language definers will > be able to pick up from there: > >http://github.com/khinsen/racket-typed-lang There is still one problem, although I am not convince

Re: [racket] Defining a typed language

2014-10-28 Thread Konrad Hinsen
E. Moran writes: > Yep... Your version was very nearly correct, and I wouldn't have been able > to find a working solution if I hadn't seen that first. The missing piece > is basically dealing with macro hygiene: > > > http://docs.racket-lang.org/guide/pattern-macros.html#(part._.Lexic

Re: [racket] Defining a typed language

2014-10-27 Thread Sam Tobin-Hochstadt
I don't understand that, unfortunately. Sam On Mon, Oct 27, 2014 at 5:43 AM, Alexander D. Knauth wrote: > I had made a pull request about this that was almost the same, but something > really weird was happening with require that I don’t understand. > > I had tried it with (datum->syntax stx ‘(

Re: [racket] Defining a typed language

2014-10-27 Thread Sam Tobin-Hochstadt
I think what happens here is that the `require` that Konrad added was getting the correct state initialized, but because of hygiene wasn't the `require` that was binding the references to `foo`. Then Evan's changes meant that the state and the binding were coming from the correct place, and it work

Re: [racket] Defining a typed language

2014-10-27 Thread E. Moran
On Mon, Oct 27, 2014 at 09:43:26AM +0100, Konrad Hinsen wrote: > It looks like it does the equivalent of adding (require > a-typed-lang/more) at the beginning of each module that uses > a-typed-lang. That's what I expected my original code to do as > well. Yep... Your version was very nearly corr

Re: [racket] Defining a typed language

2014-10-27 Thread Alexander D. Knauth
I had made a pull request about this that was almost the same, but something really weird was happening with require that I don’t understand. I had tried it with (datum->syntax stx ‘(require a-typed-lang/more)), and that worked, as long as a-typed-lang/main.rkt _didn’t_ require a-typed-lang/mo

Re: [racket] Defining a typed language

2014-10-27 Thread Konrad Hinsen
E. Moran writes: > Thanks for posting this... I was just wondering if you've considered using > the > datum->syntax trick, yet. No, because this is the first time I hear about this! First of all, your code works fine under Racket 6.1 as well, which is good. Second, I don't quite understand

Re: [racket] Defining a typed language

2014-10-26 Thread E. Moran
On Mon Oct 20 07:08:54 EDT 2014, Konrad Hinsen wrote: > I have put the code on Github for easier access: > > https://github.com/khinsen/racket-typed-lang > > Once this works, it can serve as a template for others. Thanks for posting this... I was just wondering whether you've considered using

Re: [racket] Defining a typed language

2014-10-20 Thread Konrad Hinsen
Sam Tobin-Hochstadt writes: > Hmm, that surprises me; I'll take a look. Thanks! I have put the code on Github for easier access: https://github.com/khinsen/racket-typed-lang Once this works, it can serve as a template for others. Konrad. Racket Users list: http://l

Re: [racket] Defining a typed language

2014-10-17 Thread Sam Tobin-Hochstadt
Hmm, that surprises me; I'll take a look. Sam On Oct 17, 2014 8:25 AM, "Konrad Hinsen" wrote: > Sam Tobin-Hochstadt writes: > > You should keep the original require and provide, and add the new > inserted require as an > > extra. Does that work? > > That's easy to check: > > -- test-lang/main.

Re: [racket] Defining a typed language

2014-10-17 Thread Konrad Hinsen
Sam Tobin-Hochstadt writes: > You should keep the original require and provide, and add the new inserted > require as an > extra. Does that work? That's easy to check: -- test-lang/main.rkt #lang typed-racket/minimal (require typed/racket test-lang/more

Re: [racket] Defining a typed language

2014-10-17 Thread Sam Tobin-Hochstadt
You should keep the original require and provide, and add the new inserted require as an extra. Does that work? Sam On Oct 17, 2014 6:38 AM, "Konrad Hinsen" wrote: > Sam Tobin-Hochstadt writes: > > > My suggestion is to have your `test-lang` language use > > `#%module-begin` to expand into `(t

Re: [racket] Defining a typed language

2014-10-17 Thread Konrad Hinsen
Sam Tobin-Hochstadt writes: > My suggestion is to have your `test-lang` language use > `#%module-begin` to expand into `(tr:module-begin (require > test-lang/more) user-program-here ...)`, which should fix the problem. Thanks, that sounds like a good idea... but it doesn't work either. Here's

Re: [racket] Defining a typed language

2014-10-16 Thread Sam Tobin-Hochstadt
On Thu, Oct 16, 2014 at 11:41 AM, Konrad Hinsen wrote: > Konrad Hinsen writes: > > > After a closer look at the language definition mechanism, I came to the > > conclusion that the language here is actually "s-exp", with my module > > merely providing the initial bindings. > > > > So what I s

Re: [racket] Defining a typed language

2014-10-02 Thread Konrad Hinsen
Matthias Felleisen writes: > Konrad, I am surprised you want to remove contracts from > Typed-Untyped boundaries given your history of praising types on > this mailing list. But yes, you're on the right track. I don't want to remove contracts from the boundaries, I want to remove the boundarie

Re: [racket] Defining a typed language

2014-10-02 Thread Matthias Felleisen
Konrad, I am surprised you want to remove contracts from Typed-Untyped boundaries given your history of praising types on this mailing list. But yes, you're on the right track. On Oct 2, 2014, at 1:18 AM, Konrad Hinsen wrote: > Konrad Hinsen writes: > >> Then, a module that uses it: >> >>