[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Do record type NAMEs shadow somhow?



On Mon, 25 Apr 2011 02:25:55 -0400, Alex Shinn <alexshinn@x> wrote:

> On Mon, Apr 25, 2011 at 11:24 AM, Andre van Tonder <andre@x>  
> wrote:
>> In the following sequence:
>>
>> (define-record-type <pare>
>>    (kons x y)
>>    pare?
>>    (x kar set-kar!)
>>    (y kdr))
>>
>> (define-record-type <pare>
>>    (cons x y)
>>    pair?
>>    (x car set-car!)
>>    (y cdr))
>>
>> (kar (kons 1 2))   ;; WILL THIS STILL WORK?
>>
>> In other words, will the second definition of <pare> (with different  
>> accessors)
>> in the same scope mess up the first record type definition?
>
> There's no guarantee this will work.  In a module body
> the redefinition of <pare> would be an error, in the repl
> a good implementation should give you a warning.

Specifically, DEFINE-RECORD-TYPE "binds" <pare>, though it doesn't say to  
what it is bound. In particular, I believe that under the current draft,  
records are generative. This has ramifications for everything from macros  
to environments. I actually ran into this issue (generativity of records)  
this semester with test-suite/auto-grading code.

	Aaron W. Hsu

-- 
Programming is just another word for the lost art of thinking.

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports