Re: [racket-users] parameterize working across dynamic-require and phase change

2016-12-07 Thread Robby Findler
Or another hack: put the parameter's value in teh filesystem and use
parameter guards to fish it out of there.

This would be useful only if you consider it temporary tho. :)

Robby


On Wed, Dec 7, 2016 at 2:09 PM, Matthew Flatt  wrote:
> At Wed, 7 Dec 2016 12:01:24 -0800 (PST), Dan Liebgold wrote:
>> On Tuesday, December 6, 2016 at 5:00:47 PM UTC-8, Robby Findler wrote:
>> >
>> > Perhaps there is another way to achieve the effect you want in a way
>> > that is more friendly to creating .zo files?
>> >
>>
>> Yes, this is the crux of the issue. In my case I have a system that deals 
>> with
>> modules that may or may not have .zo files. I'm try to parameterize something
>> at compile time for generating the .zo and also at dynamic-require time (when
>> the required module may or may not have the corresponding .zo file).
>>
>> The best solution would be to simplify the compile-time logic such that the
>> parameterization isn't required...  until then I may have to fix the system 
>> to
>> parameterize the phases separately.
>
> As a last resort, you might be able to use
> `dynamic-require-for-syntax`, which will let you grab a phase-1 value
> (such as a parameter) for use in phase-0 code.
>
> The `dynamic-require-for-syntax` function is a bad idea, but maybe it's
> useful in the short run.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] parameterize working across dynamic-require and phase change

2016-12-07 Thread Matthew Flatt
At Wed, 7 Dec 2016 12:01:24 -0800 (PST), Dan Liebgold wrote:
> On Tuesday, December 6, 2016 at 5:00:47 PM UTC-8, Robby Findler wrote:
> > 
> > Perhaps there is another way to achieve the effect you want in a way
> > that is more friendly to creating .zo files?
> > 
> 
> Yes, this is the crux of the issue. In my case I have a system that deals 
> with 
> modules that may or may not have .zo files. I'm try to parameterize something 
> at compile time for generating the .zo and also at dynamic-require time (when 
> the required module may or may not have the corresponding .zo file).
> 
> The best solution would be to simplify the compile-time logic such that the 
> parameterization isn't required...  until then I may have to fix the system 
> to 
> parameterize the phases separately.

As a last resort, you might be able to use
`dynamic-require-for-syntax`, which will let you grab a phase-1 value
(such as a parameter) for use in phase-0 code.

The `dynamic-require-for-syntax` function is a bad idea, but maybe it's
useful in the short run.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] parameterize working across dynamic-require and phase change

2016-12-07 Thread Dan Liebgold
On Tuesday, December 6, 2016 at 5:00:47 PM UTC-8, Robby Findler wrote:
> 
> Perhaps there is another way to achieve the effect you want in a way
> that is more friendly to creating .zo files?
> 

Yes, this is the crux of the issue. In my case I have a system that deals with 
modules that may or may not have .zo files. I'm try to parameterize something 
at compile time for generating the .zo and also at dynamic-require time (when 
the required module may or may not have the corresponding .zo file).

The best solution would be to simplify the compile-time logic such that the 
parameterization isn't required...  until then I may have to fix the system to 
parameterize the phases separately.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] parameterize working across dynamic-require and phase change

2016-12-07 Thread Matthias Felleisen

My initial reaction would be to explicitly split “module.rkt” into two pieces: 
 — its compile-time code especially an exported parameter a
 — its run-time code, which uses the same parameter 
Your client module could then require each piece at the correct phase. 

This also ought to work with the .zo files. 

I think. Perhaps. — Matthias







> On Dec 6, 2016, at 8:00 PM, Robby Findler  wrote:
> 
> My initial reaction is that that's a bad idea because it means that
> you're not cooperating separate compilation when you do things like
> that. That is, if module.rkt's compilation were affected by the
> parameter `a`, then if there were a .zo file (because someone did
> 'raco setup' or 'raco make' or the like on module.rkt), then you'd get
> one version of the code, and if there weren't, then you'd get a
> different version of the code.
> 
> Perhaps there is another way to achieve the effect you want in a way
> that is more friendly to creating .zo files?
> 
> Robby
> 
> 
> On Tue, Dec 6, 2016 at 6:28 PM, Dan Liebgold
>  wrote:
>> 
>> Hi -
>> 
>> I've asked this question privately of Matthew Flatt, but I'll throw it out 
>> to the group in case anyone else wants a crack at it.
>> 
>> If I do this:
>> 
>> (parameterize ([a 3])
>>  (dynamic-require "module.rkt" 'func)
>>  (func))
>> 
>> 
>> ...where the current module and "module.rkt" both require in parameter "a", 
>> and func uses the value "a" during the syntax phase -- (a) will not be 3... 
>> it will be the value bound during parameter creation.
>> 
>> Is there a way to parameterize a in this case?
>> 
>> Thanks,
>> Dan
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] parameterize working across dynamic-require and phase change

2016-12-06 Thread Robby Findler
My initial reaction is that that's a bad idea because it means that
you're not cooperating separate compilation when you do things like
that. That is, if module.rkt's compilation were affected by the
parameter `a`, then if there were a .zo file (because someone did
'raco setup' or 'raco make' or the like on module.rkt), then you'd get
one version of the code, and if there weren't, then you'd get a
different version of the code.

Perhaps there is another way to achieve the effect you want in a way
that is more friendly to creating .zo files?

Robby


On Tue, Dec 6, 2016 at 6:28 PM, Dan Liebgold
 wrote:
>
> Hi -
>
> I've asked this question privately of Matthew Flatt, but I'll throw it out to 
> the group in case anyone else wants a crack at it.
>
> If I do this:
>
> (parameterize ([a 3])
>   (dynamic-require "module.rkt" 'func)
>   (func))
>
>
> ...where the current module and "module.rkt" both require in parameter "a", 
> and func uses the value "a" during the syntax phase -- (a) will not be 3... 
> it will be the value bound during parameter creation.
>
> Is there a way to parameterize a in this case?
>
> Thanks,
> Dan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] parameterize working across dynamic-require and phase change

2016-12-06 Thread Dan Liebgold

Hi -

I've asked this question privately of Matthew Flatt, but I'll throw it out to 
the group in case anyone else wants a crack at it.

If I do this:

(parameterize ([a 3])
  (dynamic-require "module.rkt" 'func)
  (func))


...where the current module and "module.rkt" both require in parameter "a", and 
func uses the value "a" during the syntax phase -- (a) will not be 3... it will 
be the value bound during parameter creation.

Is there a way to parameterize a in this case?

Thanks,
Dan

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.