jerome.martin.dev
2018-9-10 08:07:53

@t Hey, thanks for this project! I made a pull request with some projects I follow or maintain: https://github.com/avelino/awesome-racket/pull/2


mflatt
2018-9-10 12:20:18

Pushed


lexi.lambda
2018-9-10 15:46:01

@robby Is there any way to “split off” a DrRacket tab into a separate window, or is the only way to close the tab and open the same file again in a new window?


robby
2018-9-10 15:51:13

That’s the only way I know. Improving seems merely like a small matter of programming. ;)


abmclin
2018-9-10 15:51:15

Thank you @mflatt ! I’ll build from the HEAD and give it a try


lexi.lambda
2018-9-10 15:51:57

Okay, I figured as much, but I thought I’d ask. Maybe I will try adding it at some point, but probably not today. :)


lexi.lambda
2018-9-10 15:55:04

@mflatt In the program #lang racket (let () (define-syntax foo (make-rename-transformer #'values)) (foo 1)) I realize that getting Check Syntax to understand the structure of the RHS of the define-syntax is largely a lost cause with the current communication channels in place, but I wonder if it couldn’t at least recognize the use of define-syntax itself. Does it make sense for the internal-definition context → letrec-syntaxes+values transformation to add/propagate 'origin properties somewhere so that uses of define-syntaxes are tracked?


lexi.lambda
2018-9-10 16:01:19

It looks like letrec-syntaxes+values is already smart enough to propagate 'origin properties on syntax binding pairs, so the transformation would just need to attach the 'origin property to the right spot.


philip.mcgrath
2018-9-10 17:08:23

I’m learning #lang slideshow for my RacketCon talk. Does anyone have or know of presentations with source code that I could look at as examples?


samth
2018-9-10 17:09:08

@philip.mcgrath do you want really impressive ones or simple ones?


philip.mcgrath
2018-9-10 17:09:24

Either/both?


samth
2018-9-10 17:09:40

here are some from @mflatt https://github.com/mflatt/talks/


samth
2018-9-10 17:10:20

here’s a very impressive one from @robby https://github.com/rfindler/icfp-2014-contracts-talk/


philip.mcgrath
2018-9-10 17:12:21

Thanks!


samth
2018-9-10 17:14:27

here’s a pretty simple and short one of mine: https://github.com/samth/iu-intro-2014


samth
2018-9-10 17:15:11

here’s a library containing a simple slide (and some complex stuff for the picture in it): https://github.com/samth/lang-slide


orl
2018-9-10 17:47:50

@orl has joined the channel


krismicinski
2018-9-10 22:43:52

Does anyone have a link to a sample repo that illustrates the “languages as libraries” approach that’s not typed racket?


krismicinski
2018-9-10 22:44:07

I want to give something to some students about this, but typed racket is too ambitious for them to understand, I think.


samth
2018-9-10 22:53:28

@krismicinski do you just want a repo that implements a language?


samth
2018-9-10 22:53:58

or do you want something that works somewhat like that paper?


samth
2018-9-10 22:54:05

or something else?


krismicinski
2018-9-10 22:54:40

Ideally, something that follows the paper’s technique of doing a local expand on the module and then walking over forms to transform them


krismicinski
2018-9-10 22:55:02

Merely adding macros via an module lang sexpr won’t be enough, for example.


krismicinski
2018-9-10 22:55:21

So “implements a language” is maybe, but I think “works somewhat like that paper” is closer to what I want.


krismicinski
2018-9-10 22:56:00

To give some context, we want to work on our own language following this technique, and could roll it from scratch using this paper, but I wanted to see if there was anything to give students that might illustrate the idea a bit more concretely


krismicinski
2018-9-10 22:56:22

right now you can use it as a #lang reader ..


krismicinski
2018-9-10 22:56:36

But for the kinds of expansions we want, we need to be able to walk over and transform things like identifiers


dan
2018-9-10 23:18:49

@krismicinski languages the racket way(lwc 2016), and herbarium racketensis(icfp 2017) both sort of fit what you’re looking for, both work through some of the steps of building a language and related tooling. I’m away from a computer right now but I can send you links to the papers and repos later if you can’t find them


krismicinski
2018-9-10 23:38:22

thanks for the pointers


krismicinski
2018-9-11 00:44:31

@leif is video-lang a good example? I was just looking at this now..


leif
2018-9-11 00:46:15

Sure. IIRC, the crux of what you want is in main.rkt and the video-begin function in base.rkt: https://github.com/videolang/video/blob/master/video/main.rkt


leif
2018-9-11 00:46:23

(For the front end language.)


leif
2018-9-11 00:46:33

(I also used plenty of DSLs all throughout the implementation.)


krismicinski
2018-9-11 00:46:35

Yeah, I was just looking at that and that seems like what I want


leif
2018-9-11 00:48:10

Okay cool. :slightly_smiling_face:


krismicinski
2018-9-11 00:48:17

I’m sure there are other examples


krismicinski
2018-9-11 00:48:20

and I should also look into those


leif
2018-9-11 00:48:24

If you have any questions, and/or improvement thoughts please let me know .:)


krismicinski
2018-9-11 00:48:25

video-lang seems like a medium-sized one


krismicinski
2018-9-11 00:48:42

My frank guess is that I’ll have to take a week or two to digest it


krismicinski
2018-9-11 00:49:14

we’ve realized that we need to walk over variable bindings for our language to work, so just using plain macros won’t be enough, I’m sure we’ll just have to pull info from a few sources


krismicinski
2018-9-11 00:49:23

but my students probably aren’t strong enough to just read the typed racket code just yet


leif
2018-9-11 00:49:41

Oh, honestly, I think the smallest (and cutest) one that I have is #lang sml.


krismicinski
2018-9-11 00:49:46

ah ok


leif
2018-9-11 00:49:51

(Which is not standard ml, but the s-markup language).


leif
2018-9-11 00:50:14

I wrote it in about an hour after getting annoyed at things like YAML.


krismicinski
2018-9-11 00:50:17

krismicinski
2018-9-11 00:50:22

oh I’ve seen this actually.



krismicinski
2018-9-11 00:50:47

just forgot about this


leif
2018-9-11 00:50:52

Ya, I…err…didn’t write any comments in it, because it was just a quick hack.


leif
2018-9-11 00:51:14

But it’s super convenient. Like, my calendar, and even resume use it.


krismicinski
2018-9-11 00:51:30

right, I think the biggest hurdle for my students (and me) to tackle is the various interrelated ways of hacking these things up. I’m not really a macro or racket expert, so this is mostly me kicking things along



krismicinski
2018-9-11 00:51:55

nice!


leif
2018-9-11 00:52:05

Fair.


leif
2018-9-11 00:52:41

There are about 3–5 tricks that go into that, namely


leif
2018-9-11 00:53:38

Namely, 1. Lifting out expressions so the code can be a data definition.


leif
2018-9-11 00:54:01
  1. Using ‘paren-shape’ to distinguish between (, {, and [.

leif
2018-9-11 00:54:40
  1. Any free identifiers ending with : are treated as a symbol.

leif
2018-9-11 00:55:04

And 4. Using {{ for string literals. (Sadly that one was the hackiest. and is responsible for about half of the code.)


leif
2018-9-11 00:57:27

I should write a blog post on it.


leif
2018-9-11 00:57:35

Anyway, if you have any questiosn, feel free to ask. :slightly_smiling_face:


krismicinski
2018-9-11 00:58:02

I don’t quite get what you mean by (1): what is a data definition in this context?


krismicinski
2018-9-11 00:58:42

Maybe I should try to grok your code more, it probably will make sense once I get it. Something like you need to isolate out the code from the non-code, since your language is meant to work with non-code stuff, and you need to pull that up into a big block before the main evaluation actually runs to create (e.g.,) your cv


krismicinski
2018-9-11 00:58:47

Is that approximately the right idea?


leif
2018-9-11 01:44:53

Oh, sorry, I just meant, I want the default context to be just data.


leif
2018-9-11 01:45:14

Like, in a latex file, by default you’re typing prose, and you have to use some language form to go to another context.


leif
2018-9-11 01:45:22

Or like html, or scribble.


leif
2018-9-11 01:45:27

Does that make more sense?


krismicinski
2018-9-11 01:50:48

yeah that makes sense


krismicinski
2018-9-11 01:50:55

this looks great


krismicinski
2018-9-11 01:51:01

I think it’ll be some good fodder


krismicinski
2018-9-11 01:51:11

this + video-lang will give some good stuff to have students dig into


leif
2018-9-11 01:53:16

Okay cool. I look forward to seeing how it goes. :smile:


jacob.d.mitchell
2018-9-11 01:58:18

@krismicinski, have you come across Beautiful Racket (https://beautifulracket.com)? Its tutorials involve implementing several languages, including a Basic interpreter with variables, gotos, subroutines (gosub), and even functions. I only recently worked through it and haven’t read the languages as libraries paper yet so I’m not sure it’s what you’re looking for. I found it very helpful for getting over my fear of planning new language projects using Racket.


jacob.d.mitchell
2018-9-11 02:02:52

By the way, @leif, I recently watched your video-lang talk and really enjoyed it. I’m eager to poke around in the code to learn how the custom GUI controls are implemented. Providing visual programming DSLs, if that’s the right way to put it, seems super useful!


leif
2018-9-11 02:09:12

@krismicinski & @jacob.d.mitchell I concur, beautiful racket is great. It doesn’t go into many of the super duper advanced bleeding edge things, but it does show you how to do some cool things with languages as libraries.


leif
2018-9-11 02:10:19

Also, @jacob.d.mitchell thanks. ^.^ The existing GUI code is somewhat boring, you can find it in player.rkt: https://github.com/videolang/video/blob/master/video/player.rkt



leif
2018-9-11 02:11:36

(The first being the video-canvas that allows you to embed videos into any racket program (including slideshows), the second being the prototype gui editors.


leif
2018-9-11 02:12:24

This repo: https://github.com/videolang/idmt contains the current state of my non-textual (visual) macro’s experiment. But its still very early days for that.


leif
2018-9-11 02:12:37

Thanks to @lexi.lambda and her RacketCOn talk a few years back. ^.^


krismicinski
2018-9-11 03:00:26

Yes, I’ve read through beautiful racket, but I don’t think it covers much of the languages-as-libraries approach, unfortunately


krismicinski
2018-9-11 03:00:34

That book is very helpful for most of the cases you’d want


krismicinski
2018-9-11 03:00:58

But we need to rewrite core parts of the AST, unfortunately, including things like variables, etc..


krismicinski
2018-9-11 03:01:30

(Specifically, our language has nuanced interactions with state, so we need to do things like rewrite variable occurrences to forms that call out to maintain the secrecy of various variables)


krismicinski
2018-9-11 03:02:30

I think the languages as libraries paper is a good reference, the idea of doing a local-expand at the toplevel module definition, then doing your own work, that really is what we’re going to need, I think.


krismicinski
2018-9-11 03:02:37

I’ll let you all know as we keep hacking on it


krismicinski
2018-9-11 03:02:49

I’m sure there are a variety of ways to do it once you really know the internals of the macro system


david.emily
2018-9-11 04:01:26

@david.emily has joined the channel


wottis
2018-9-11 06:06:13

greetings


wottis
2018-9-11 06:06:46

did someone else also experience that same error when using typed racket? http://pasterack.org/pastes/8526


wottis
2018-9-11 06:10:30

when moving that stuff into a different module and providing it from there to the other one it type checks without problems. But that is just weird and something i don’t want.


wottis
2018-9-11 06:46:51

wooo. found a good workaround \o/.