pocmatos
2018-6-11 13:55:52

Isn’t it odd, that if I write a small macro using syntax-parse but forget to require syntax/parse, I don’t get an undefined identifier for syntax-parse? Instead I get an error about _?


pocmatos
2018-6-11 13:55:55

Try this


pocmatos
2018-6-11 13:56:05
#lang racket

(define-syntax (make-banana stx)
  (syntax-parse stx
    [(_ name:id)
     #:with out
     (format-id #'name "banana-~a" #'name)

     #'(define (a-banana) name)]))

samth
2018-6-11 13:56:39

That’s an unfortunate consequence of expansion order


samth
2018-6-11 13:57:05

if you didn’t have an _, you’d get an error about syntax-parse


pocmatos
2018-6-11 13:57:30

ah… :slightly_smiling_face: ok…


pocmatos
2018-6-11 13:57:39

well fair enough. at least it’s a known issue.


greg
2018-6-11 14:20:53

Using #lang racket/base instead, you do get “syntax-parse: unbound identifier in the transformer environment” Of course what I used to do next was: 1. (require syntax-parse) 2. (require syntax/parse) 3. (require (for-syntax syntax/parse)) 4. syntax is undefined….??? 5. Eventually: (require (for-syntax racket/base syntax/parse)) This was probably when I started slapping together Fear of Macros ¯_(ツ)_/¯


pocmatos
2018-6-11 14:28:08

@greg treading the same path.


greg
2018-6-11 14:30:13

lol I made the same syntax-parse typo in 5 above; just fixed it


greg
2018-6-11 14:30:55

Oh and 3. Fixed also.


greg
2018-6-11 14:31:18

Really, I know how to racket.


greg
2018-6-11 14:31:26

drinks more coffee


pocmatos
2018-6-11 14:47:58

So, the latest one driving me crazy is this error that marks no line for problems. I managed to reduce it to a simple example (longer example is in the mailing list): #lang racket (require racket/generic (for-syntax syntax/parse racket/syntax)) (define-generics fruit (fruit-name-len fruit)) (define-syntax (make-fruit stx) (syntax-parse stx [(_ name:id) #:with name-len (string-length (format "fruit-~a" #'name)) #'(struct name (type) #:methods gen:fruit ((define (fruit-name-len f) name-len)))])) (make-fruit banana) Used banana and fruit to avoid the usual foo and bar but don’t expect the example to make sense.


pocmatos
2018-6-11 14:48:02

Error is this beautiful:


pocmatos
2018-6-11 14:48:12
?: literal data is not allowed;
 no #%datum syntax transformer is bound in: 28

pocmatos
2018-6-11 14:48:17

Expansion looks ok.


pocmatos
2018-6-11 14:48:51

If I copy paste expansion to repl is also fine but just running the whole thing returns this interesting ?.


pocmatos
2018-6-11 14:49:14

At this point, I wish I could reply back to the repl with ? to force him to give me more information. :slightly_smiling_face:


lexi.lambda
2018-6-11 14:50:22

@pocmatos The ? means there is no source location information on the 28, which makes sense, since you’re implicitly converting it to syntax using #:with. I’ll give a longer explanation on the mailing list (and how to fix it).


greg
2018-6-11 14:53:36

Speaking of FoM, I will update the sloppy format-id examples: https://stackoverflow.com/a/50559918/343414 But also, now I’m wondering why format-id’s lctx arg is (or/c syntax? #f). Instead would it be more helpful if it took (or/c identifier? #f) or even just identifier? (Not necessarily proposing changing format-id. Maybe just defining a “safer” alternative wrapper.)


pocmatos
2018-6-11 14:54:47

@lexi.lambda ok, thanks. will eagerly await the explanation.


lexi.lambda
2018-6-11 14:55:19

@greg I think sometimes it’s the right thing to do to take lexical context from something that isn’t an identifier


greg
2018-6-11 14:58:11

When making another identifier? OK. I still might define a little wrapper that helps remind me “don’t just pass stx”.


jerome.martin.dev
2018-6-11 15:04:51

I usually pass stx so I’m curious: what’s the matter?


greg
2018-6-11 15:07:03

@jerome.martin.dev See that SO link for example.


pocmatos
2018-6-11 15:24:47

@lexi.lambda thanks for your reply. Will reply to the mailing list for the benefit of all.


jerome.martin.dev
2018-6-11 15:25:58

@greg Oh… I see.. Time to fix my code then! :stuck_out_tongue:


ghoetker
2018-6-11 20:58:33

Sooo, I started DrRacket this morning and the splash screen was something new….as far as I can tell, an animated sea-turtle on a plaid background. Nothing wrong with that, although it was a bit startling. However, DrRacket is also exhibiting some issues like blank space where menu entries should be. I’ve used package manager to remove all packages except those installed automatically and deleted/reinstalled Racket. The problem persists. Running Racket 6.12 on MacOS 10.13.5. Anyone else having similar issues? Can anyone suggest a solution (to the missing menu items—the sea-turtle is kinda cute and is welcome to stay). Thank you very much.


nocheroot
2018-6-11 22:47:26

Something like that happened to me a while back (today I also had the sea turtle btw). Had a black star as a splash. Thought it was caused by a package I had recently installed, and was unnerved by it. Removed it, reinstalled Racket, still had the weird splash. Set it aside, thinking there was some kind of profile or temp file problem I would just deal with the next day. Next day, splash back to normal. I think on some dates drracket has different splash screens (just for fun?). Though I have not seen any documentation to support that.


mflatt
2018-6-11 22:53:55

@ghoetker The turtle is intentional for King Kamehameha Day. The missing menu entries are not! Maybe the missing menu entries depend on the Mac OS version, since I don’t that yet, but can you tell me more specifically where to look?


greg
2018-6-11 23:49:58

pushed some long-overdue commits for Fear of Macros https://github.com/greghendershott/fear-of-macros/commits/master


ghoetker
2018-6-12 00:21:40

@mflatt The turtle is awesome! The missing menu items are all in the View menu. The first two items are missing, as is the item below “Hide Line Numbers”.


ghoetker
2018-6-12 00:23:42

@nocheroot Thanks for sharing your experience. Per @mflatt, it is deliberate (and quite cool!).


mflatt
2018-6-12 00:44:21

@ghoetker Thanks - I do see the missing menu items on Mac OS 10.13. It doesn’t seem to be related to the turtle, though, since I get the same result when running with PLTDREASTERSECONDS set to claim a different day for startup-window purposes. I’ll investigate more.


mflatt
2018-6-12 00:45:53

The missing menu items all have a number in the intended content, so that’s probably relevant


nocheroot
2018-6-12 00:45:54

@ghoetker It is cool. Too bad I’m paranoid (professionally) and was incapable of enjoying the surprise the first time around. I think it was a five pointed black star with a lambda. Luckily I was on a vm. I might have had a stroke if it happened on a production workstation.


samth
2018-6-12 00:59:52

@nocheroot that’s for Texas independence day


samth
2018-6-12 01:00:27

Incidentally, we do test all those start-up variants in CI (thanks to a bad incident in the past)


uldis.megnis
2018-6-12 04:20:06

@uldis.megnis has joined the channel