Support a setup that reverted #%top to its usual meaning #183

Closed
opened 6 years ago by sorawee · 5 comments
sorawee commented 6 years ago (Migrated from github.com)

Per https://groups.google.com/forum/#!searchin/pollenpub/unbound%7Csort:date/pollenpub/gpRk-s1cMNA/Kji1D73aDwAJ, it would be nice if there's an option to opt-out of Pollen's #%top overriding. This can be done by either providing a setup value or a new (sub)language. A setup value might be more preferable since Pollen has sublanguages like #lang pollen/markup, #lang pollen/ptree, etc. already, and it wouldn't interact well with this orthogonal feature.

Per https://groups.google.com/forum/#!searchin/pollenpub/unbound%7Csort:date/pollenpub/gpRk-s1cMNA/Kji1D73aDwAJ, it would be nice if there's an option to opt-out of Pollen's `#%top` overriding. This can be done by either providing a setup value or a new (sub)language. A setup value might be more preferable since Pollen has sublanguages like `#lang pollen/markup`, `#lang pollen/ptree`, etc. already, and it wouldn't interact well with this orthogonal feature.
mbutterick commented 6 years ago (Migrated from github.com)

If we revert #%top to its usual meaning, and root is not defined in "pollen.rkt", then what should happen? Consistency seems to dictate that root raise an unbound-identifier error.

If we revert `#%top` to its usual meaning, and `root` is not defined in `"pollen.rkt"`, then what should happen? Consistency seems to dictate that `root` raise an unbound-identifier error.
mbutterick commented 6 years ago (Migrated from github.com)

I’ve pushed a patch for this. Why don’t you try it out and see if it does what you expect. If so, I’ll add it to the docs.

I’ve introduced a new setup value called allow-unbound-ids. If set to #false, it will raise an error for unbound identifiers (= the typical #%top behavior):

#lang racket/base
(provide (all-defined-out))

(module setup racket/base
  (provide allow-unbound-ids)
  (define allow-unbound-ids #false))
I’ve pushed a patch for this. Why don’t you try it out and see if it does what you expect. If so, I’ll add it to the docs. I’ve introduced a new `setup` value called `allow-unbound-ids`. If set to `#false`, it will raise an error for unbound identifiers (= the typical `#%top` behavior): ```racket #lang racket/base (provide (all-defined-out)) (module setup racket/base (provide allow-unbound-ids) (define allow-unbound-ids #false)) ```
sorawee commented 6 years ago (Migrated from github.com)

Yup, this is exactly what I expect. Thank you again :)

Yup, this is exactly what I expect. Thank you again :)
sorawee commented 6 years ago (Migrated from github.com)

Re: root, right, that would be an unbound id error. It's a one time thing to do, and you need pollen.rkt to setup allow-unbound-ids already anyway, so it's relatively easy to do.

Re: root, right, that would be an unbound id error. It's a one time thing to do, and you need `pollen.rkt` to setup `allow-unbound-ids` already anyway, so it's relatively easy to do.
mbutterick commented 6 years ago (Migrated from github.com)

In Pollen 2.0, I changed the name of this setup to allow-unbound-ids? (with ?) to be consistent with the usual convention for predicate-style functions. It had not yet been documented so the provisional allow-unbound-ids (without ?) is no longer supported.

In Pollen 2.0, I changed the name of this setup to `allow-unbound-ids?` (with `?`) to be consistent with the usual convention for predicate-style functions. It had not yet been documented so the provisional `allow-unbound-ids` (without `?`) is no longer supported.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen#183
Loading…
There is no content yet.