You got it.

> On Apr 15, 2015, at 10:19 PM, Alexander D. Knauth <alexan...@knauth.org> 
> wrote:
> 
> 
>> On Apr 15, 2015, at 10:12 PM, Jon Zeppieri <zeppi...@gmail.com> wrote:
>> 
>> On Wed, Apr 15, 2015 at 9:35 PM, Alexander D. Knauth
>> <alexan...@knauth.org> wrote:
>>> 
>>>> On Apr 15, 2015, at 2:29 PM, Jon Zeppieri <zeppi...@gmail.com> wrote:
>>>> 
>>>> I'm trying to provide a struct, the struct type of which uses
>>>> prop:procedure and prop:match-expander, and I'd like the procedure to
>>>> have a contract.
>>>> 
>>>> If I simply (provide <identifier>)
>>> 
>>> Is this identifier the constructor function, or an instance of this struct?
>>> If it’s the constructor function, then couldn’t you use (provide 
>>> (contract-out [struct id ([field contract] …)])) for that?
>>> If it’s an instance, then are you doing something different to define it as 
>>> a transformer binding?
>> 
>> It's an instance of a struct. Here's the background: I have a struct
>> type, created with `struct`, which has its own constructor and match
>> expander. However, I don't want to use that constructor or match
>> expander as part of the public interface. (The struct contains some
>> fields that should be treated as private.) Now, the only way I know to
>> provide a single identifier that can act as both a struct constructor
>> and a match expander is to use a struct. So, in this case, I need to
>> use a *different* struct type, an instance of which can be used, on
>> one hand, as a procedure to construct an instance of the original
>> struct type, and on the other, as a match expander (also for the
>> original struct type).
> 
> So If I understand correctly what you’re doing, you have a normal struct A, 
> at “runtime” with a transformer binding like normal structs have.
> Then you have a compile-time struct B, which has prop:procedure and 
> prop:match-expander, where you want an instance of B to be the right-hand 
> side of a (define-syntax <identifier> (B ….))?  Is that correct?  And the 
> prop:procedure in B will expand to something like (A ….), and the 
> prop:match-expander in B will expand to (A ….) as a match pattern?  Or am I 
> misunderstanding what you’re trying to do?
> 
> 

-- 
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.

Reply via email to