[plt-scheme] If With No Else and Other Changes

From: Ryan Culpepper (ryanc at ccs.neu.edu)
Date: Fri Feb 1 15:42:20 EST 2008

On Feb 1, 2008, at 10:15 AM, Doug Williams wrote:

> I think V4 is a good step forward and I certainly welcome it.  I'm not  
> that worried about converting my code over to it.  What I am worried  
> about is that there doesn't seem to be a practical way, that I've  
> seen, to maintain a single PLaneT package that is compliant with both  
> V4 and V3. 

I've found that it's usually possible to make code written for 3xx to  
work for 4. Danny Yoo's version-case.plt package is helpful for the  
trickier parts.

Keywords are tricky, because the (lib "kw.ss") protocol from 3xx is  
different from the scheme keyword protocol in 4. However, it seems  
possible to usually get them to work right together using  
'make-keyword-procedure' to translate the v4 protocol to the old one.  
The trick is implemented in my spgsql package; see the code here:

http://planet.plt-scheme.org/package-source/schematics/spgsql.plt/2/3/ 
private/compat.ss

It provides a 'lambda/kw' that is just like the 'lambda/kw' from (lib  
"kw.ss"), except that the resulting procedure can be used with the  
keyword protocol of both 3xx and 4.

It's used by the definition of 'connect' here:

http://planet.plt-scheme.org/package-source/schematics/spgsql.plt/2/3/ 
spgsql.ss

Ryan


>  I certainly don't see how I can make use many of the new V4 features  
> in a PLaneT package and retain that compatibility.

> On Fri, Feb 1, 2008 at 3:53 AM, Dave Gurnell <d.j.gurnell at gmail.com>  
> wrote:
>> > What other constructs might bite us?
>>
>> Hi Doug,
>>
>>  There are a lot of great improvements in PLT4, and on the whole the
>>  transition process is not too bad. However, there are a couple of
>>  areas in which I've had problems:
>>
>>  I've been having lots of problems with keyword arguments. There is a
>>  fundamental difference in the way they work in the mzscheme and  
>> scheme/
>>  base languages, and there are issues that still need ironing out:
>>
>>    - the semantics of keyword arguments have changed: you can no
>>  longer pass arbitrary keywords to a procedure and ignore those you  
>> are
>>  not expecting (on the other hand, unrecognised keywords are found at
>>  compile time);
>>
>>    - AFAIK, modules in the mzscheme language cannot call keyword
>>  procedures in modules written in scheme/base;
>>
>>    - also AFAIK, modules in scheme/base cannot call keyword procedures
>>  in mzscheme modules;
>>
>>    - the new style contracts from scheme/contract work fine with old
>>  style lambdas and opt-lambdas, but they do not work with lambda/kws;
>>
>>    - class.ss currently does not work correctly with either keyword
>>  system (I've filed a bug report about this one too).
>>
>>  There are also some differences between the structure subforms in
>>  provide and provide/contract. If you provide a structure using  
>> provide/
>>  contract, you cannot re-provide it using provide and struct-out. For
>>  example:
>>
>>    (module a scheme/base
>>      (require scheme/contract)
>>      (define-struct person (name) #:transparent)
>>      (provide/contract (struct person ([name string?]))))
>>
>>    (module b scheme/base
>>      (require (file "a.ss"))
>>      (provide (struct-out person)))
>>
>>  That's all I can think of for now.
>>
>>  Cheers,
>>
>>  -- Dave
>>
>>  _________________________________________________
>>   For list-related administrative tasks:
>>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.