On Monday, November 7, 2016 at 11:19:22 AM UTC-8, David K. Storrs wrote:
> Out of curiosity, why do you want this?
Some context: https://github.com/jackfirth/lens/issues/290
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from th
Out of curiosity, why do you want this?
On Mon, Nov 7, 2016 at 1:27 PM, Alex Knauth wrote:
>
> > On Nov 4, 2016, at 4:58 PM, Sam Tobin-Hochstadt
> wrote:
> >
> > Here's an example:
>
> Oh, so this only raises an error when creating an *instance* of y, not
> when creating the struct-type for y.
> On Nov 4, 2016, at 4:58 PM, Sam Tobin-Hochstadt wrote:
>
> Here's an example:
Oh, so this only raises an error when creating an *instance* of y, not when
creating the struct-type for y. Is there any way to make it raise an error on
the make-struct-type call?
Alex Knauth
> #lang racket
>
Here's an example:
#lang racket
(define (make-final-struct-type name count)
(define-values (type constructor predicate accessor mutator)
(make-struct-type name #f count 0))
(values (chaperone-struct-type type (λ _ (error 'fail1))
(λ _ (error 'fail2))
Look at `chaperone-struct-type`:
http://docs.racket-lang.org/reference/chaperones.html?q=chaperone-struct-type#%28def._%28%28quote._~23~25kernel%29._chaperone-struct-type%29%29
You can just have the guard always error.
Sam
On Fri, Nov 4, 2016 at 4:49 PM, Alex Knauth wrote:
>
>> On Nov 4, 2016,
> On Nov 4, 2016, at 4:43 PM, Sam Tobin-Hochstadt wrote:
>
> Typed Racket chaperones the struct type to prevent further extension.
Ok, thanks. Where would I go to see how I would create a chaperone like this?
> Sam
>
> On Fri, Nov 4, 2016 at 4:29 PM, Alex Knauth wrote:
>> Hello,
>>
>> Is th
Typed Racket chaperones the struct type to prevent further extension.
Sam
On Fri, Nov 4, 2016 at 4:29 PM, Alex Knauth wrote:
> Hello,
>
> Is there a way to enforce that a particular struct is final, in other words,
> that no one can declare a sub-struct of it?
>
> (struct foo (a b c) #:final)
>
Hello,
Is there a way to enforce that a particular struct is final, in other words,
that no one can declare a sub-struct of it?
(struct foo (a b c) #:final)
(struct bar foo (d e f))
; should produce a syntax error similar to:
; struct: cannot inherit from the final struct foo
(make-struct-type
8 matches
Mail list logo