Yes, I’d considered that point, and yes, it makes sense. Anyway, the situation
in which I was trying to do something like this ended up being unnecessary, so
I don’t even have a valid use-case anymore. I think it’s probably okay to leave
it as-is unless someone can come up with a useful reason
I haven’t dug deep enough into the TR code to know for sure, but I think the
difference is that structs declare fundamentally new types, whereas inline type
definitions only declare type aliases. Whether or not this is actually the
problem is unclear—I don’t know TR well enough to answer that.
On Thu, Jan 22, 2015 at 3:57 PM, Alexis King lexi.lam...@gmail.com wrote:
I can work around this in a variety of ways—I can extract this into an
untyped module and use require/typed, I can use vectors to “fake” structs
and provide an appropriate interface, etc. Still, I wonder if there are any
There’s a bug report about this here:
http://bugs.racket-lang.org/query/?cmd=viewpr=14524
Though I notice it gives a different error message now.
But why should structure type declarations being a module-wide construct?
Internal function definitions work, and internal type definitions work, so why
Simple enough. This works:
#lang racket
(define (make-me-a-struct)
(struct foo ())
(foo))
(make-me-a-struct) ; = #foo
This does not:
#lang typed/racket
(define (make-me-a-struct)
(struct foo ())
(foo)) ; error: cannot apply a function with unknown arity
(make-me-a-struct)
This
5 matches
Mail list logo