Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs
John Cowan
(12 Oct 2012 02:53 UTC)
|
||
Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs
John Boyle
(12 Oct 2012 04:27 UTC)
|
||
(missing)
|
||
(missing)
|
||
(missing)
|
||
(missing)
|
||
Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs Eli Barzilay (12 Oct 2012 19:01 UTC)
|
||
Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs
Vassil Nikolov
(13 Oct 2012 02:37 UTC)
|
||
Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs
Eli Barzilay
(12 Oct 2012 18:55 UTC)
|
||
Re: [Scheme-reports] Formal Response #382: Allow "if" to accept arbitrarily many if-then pairs
Vassil Nikolov
(13 Oct 2012 02:34 UTC)
|
Earlier today, John Boyle wrote: > [...] > > As you show, it is possible to define "if" to be used at > compile-time, but this is not satisfactory because the macros I > proceed to define, using if, will not be usable at compile-time to > define a third set of macros. I could (for-syntax <define the > second set of macros>), which would make them available at > compile-time, but that would not succeed because "if" does not have > the right definition at phase 2 (used when defining macros for > compile-time). This could be fixed by (for-syntax (for-syntax > <define if the way I want>)). However, if I wanted to define more > macros that depended on the third set, I would need to (for-syntax > (for-syntax <define second set of macros>)), and (for-syntax > (for-syntax (for-syntax <define if>))). And so on. I considered > some schemes like defining a "define-macro" procedure that would > write all previous definitions to a file and require it > (for-syntax), but decided this was getting ridiculous--these are the > insane workarounds I mentioned. There's no need for that -- you can just use one definition and put it in a file: #lang racket/base (provide (except-out (all-from-out racket/base) if) (rename-out [my-if if])) (define-syntax my-if ...) And then you just `require' that one file into any level that you need. This is just like using `racket/base' which doesn't give you any real language at the macro level so you explicitly prefix the code with a (require (for-syntax racket/base)) -- you'll get the same thing, only using your own language like that. Earlier today, John Boyle wrote: > [...] (There are still two namespaces, but that can be dealt > with--at worst, using binding and assignment constructs that affect > both namespaces.) That's a very dangerous path. You'll need to redefine huge parts of the language. For example, if you add some `define' macro that does both `defun' and `defvar', you still get weird behavior when you use `let'. -- ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay: http://barzilay.org/ Maze is Life! _______________________________________________ Scheme-reports mailing list Scheme-reports@scheme-reports.org http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports