> On Mar 26, 2018, at 9:36 AM, Jens Axel Søgaard <jensa...@soegaard.net> wrote:
> 
> 2018-03-26 17:58 GMT+02:00 Kevin Forchione <lyss...@gmail.com 
> <mailto:lyss...@gmail.com>>:
> In another thread on structs it was confirmed that structs are in essence a 
> vector with some fancy bindings associated. But there must be more going on, 
> for instance, the definition (struct foo (A B)) creates a function foo that 
> when applied does not print like a vector. Is there any documentation 
> instructs that does into the details of what they are and are doing under the 
> hood?
> 
> FWIW here is my way of implementing structs in JavaScript. I assume the C 
> implementation 
> of structs is similar.
> 
> https://github.com/soegaard/urlang/blob/master/compiler-rjs/runtime.rkt#L1730 
> <https://github.com/soegaard/urlang/blob/master/compiler-rjs/runtime.rkt#L1730>
> 
> The most difficult part to implement is structs with supers.
> 
> The C implementation is here:
> 
> https://github.com/racket/racket/blob/master/racket/src/racket/src/struct.c 
> <https://github.com/racket/racket/blob/master/racket/src/racket/src/struct.c>
> 
> 
> /Jens Axel
> 
Thanks! That’s a fascinating artifact. I hadn’t realized structs went down to C 
code. I’d assumed they were built from Racket vectors, which in  turn were 
built on Racket lists, built on Racket pairs, with pairs maybe in C. LOL. 
Probably not the efficient way to do it, which is why it’s in C? 

Kevin

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