Heap vs stack allocation?

5 views
Skip to first unread message

Martin Angers

unread,
Jul 10, 2015, 9:18:28 PM7/10/15
to crack-l...@googlegroups.com
Reading the crack manual, if I'm not mistaken, it mentions that classes are always allocated on the heap (http://www.mindhog.net/~mmuller/projects/crack/Manual-0.10.html#classes). I also see that there's a @struct annotation. I'm I correct in assuming that the @struct is allocated on the stack (not mentioned explicitly in the manual) and the classes are heap-allocated? Otherwise is there any way to allocate a compound data type on the stack?

Thanks,
Martin

Michael Muller

unread,
Jul 10, 2015, 9:53:17 PM7/10/15
to crack-lang-dev
There is currently no way to allocate a compound data type on the stack.  

This is a difficult design trade-off.  Stack allocation admits the possibility of stack-overwrites, so I've been trying to avoid it.  But I think that at some point we will probably have to allow allocation of stack-based aggregates just because of the performance benefits.  Sorry, it's not there yet.

--
You received this message because you are subscribed to the Google Groups "crack-lang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to crack-lang-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Angers

unread,
Jul 10, 2015, 10:14:40 PM7/10/15
to crack-lang-dev
Thanks, that's fine, I know the language is not "done" yet (and language design is hard and full of compromises). FWIW I do think it should be possible, as you say, for performance considerations, but I'm really in no position to make such comments on the language having barely written a few dozen lines in it :)


You received this message because you are subscribed to a topic in the Google Groups "crack-lang-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/crack-lang-dev/jYUfepdR8h8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to crack-lang-de...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages