
Hello, I would like to make a parameter that must be explicitly initialized. My initial implementation was to (make-parameter 'must-initialize-storage-to-a-dict)
but I would like it to throw a helpful error when accessed. Is that possible?

Maybe you can add a guard to the parameter, and ensure it has a good value by setting it to its own value: (p (p))
#lang racket/base
(define p (make-parameter #f (λ (x)
(unless (number? x)
(error "Not a number:" x))
x)))
(p (p))

Have you seen make-derived-parameter
? Could be what you’re looking for. :) https://docs.racket-lang.org/reference/parameters.html#%28def._%28%28quote._~23~25kernel%29._make-derived-parameter%29%29\|https://docs.racket-lang.org/reference/parameters.html#%28def._%28%28quote._~23~25kernel%29._make-derived-parameter%29%29

That looks pretty good, Thanks!

This works too for me, thank you!

Just remember, at the guard doesn’t return a boolean - it returns the new element. So the example needs to be: (define p (make-parameter #f (λ (x)
(unless (number? x)
(error "Not a number:" x))
x)))
I got bit by that bug last week :slightly_smiling_face:

thanks, edited.

I’m trying to submit a package to the official catalog, but I am either getting a message that simply says “save failed” or getting back to a fresh submission page

NVM. I figured out. The name of the package in the form should not contain spaces