🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Tuple support implemented

Published August 28, 2008
Advertisement
Tuples are most of the way implemented in Epoch now. I'm continually (and pleasantly) surprised by how much easier it is to do things than I would have guessed. Thus far most of the language features have taken far less time to implement than I would have predicted.

So either I'm making a monumental number of mistakes, or I've finally spent enough time in the programming world to really grok how languages work under the skin. Either way, the last time I did a language (a simple scripting language) it took a lot more effort and stress.


I'm sure you're all on the edges of your seats waiting to find out what tuples look like in Epoch. Well, here you go - a nice shiny example program from the upcoming Release 4 distribution:

//// TUPLES.EPOCH//// Simple demonstration of how to use tuple types in Epoch//tuple demotype : (integer(intvalue), string(strvalue))entrypoint : () -> (){	demotype(test, 0, "")	assign(test, foofunction())	debugwritestring(cast(string, readtuple(test, intvalue)))	debugwritestring(readtuple(test, strvalue))}foofunction : () -> (integer(intvalue, 0), string(strvalue, "")){	assign(intvalue, 42)	assign(strvalue, "test")}



There's a few odds and ends left to polish up (you can't do much with tuples aside from read values out of them; equality comparisons don't work yet, for example) but the bulk of the grunt work is finished.

The next phase is to implement structures. As I noted before, the main difference between a tuple and a structure in Epoch is that a structure is automatically padded, whereas a tuple is automatically packed. (That, and structures will use the structure keyword instead of the tuple keyword.)


Once that stuff is done, I'll be making a last pass over the code to take care of some assorted TODOs and improving a handful of error messages. (It's not really useful to have your program die with the cryptic "Not implemented" error, for instance.)


For now, though, I'm just stoked that the basics of tuples are all in place. I'm also quite tired, and I need to quit staying up late to hack on this project. It's just too much fun [grin]
0 likes 3 comments

Comments

Daerax
So Epoch is a full fledged language and not a mere scripting language huh. You know I was never quite clear on what Epoch's goals were. I always thought it was meant to be a fast scripting language geared towards the needs of game programmers.

When you say structures do you mean structs/records/packages? I always thought you meant complex data structures like dictionaries and lists when you said structures hehe.

If so then another difference between the structs and tuple would be that structs have labels while tuples do not.

Finally, languages like Cyclone and BitC might be good inspiration for the type of low level but safe memory management you want.

Finally, Finally, since you may well end up with a language that targets native code you may be interested in C--.
August 28, 2008 12:57 PM
benryves
This is looking increasingly awesome. [smile] You mention packed/unpacked differences; will you be able to lay out structs any way you like in memory (eg unions) if need be?

Keep up the good work! (Another way of saying: yes, you have interested readers). [wink]
August 28, 2008 01:38 PM
ApochPiQ
Quote: Original post by Daerax
So Epoch is a full fledged language and not a mere scripting language huh. You know I was never quite clear on what Epoch's goals were. I always thought it was meant to be a fast scripting language geared towards the needs of game programmers.

When you say structures do you mean structs/records/packages? I always thought you meant complex data structures like dictionaries and lists when you said structures hehe.

If so then another difference between the structs and tuple would be that structs have labels while tuples do not.

Finally, languages like Cyclone and BitC might be good inspiration for the type of low level but safe memory management you want.

Finally, Finally, since you may well end up with a language that targets native code you may be interested in C--.


IMHO there's already enough scripting languages out there. Between Lua, Python, ECMAScript, and all the other easily-embeddable scripting engines, I just don't see a need for Yet Another Game Script Language.

The main goal I want to accomplish with Epoch is development of robust, highly validated software with rich multiprocessing capabilities. Basically, I foresee a shift towards asymmetric multiprocessing in the future, and I want the software side of things to be ready when the hardware revolution happens. (Now that I think about it, I might need to sit down and write a specific entry detailing the goals and plans I've got for Epoch...)

Yes, structures == records. Also, while I know it is traditional for tuples to be unlabeled, I wanted to implement labeled tuples first to get them working nicely. Anonymous tuple types will follow later on, when I get into the type inference engine and some of that stuff. So for now a tuple is really a packed struct in disguise [wink]

I'll look into those other languages as well, thanks!


Quote: Original post by benryves
This is looking increasingly awesome. [smile] You mention packed/unpacked differences; will you be able to lay out structs any way you like in memory (eg unions) if need be?

Keep up the good work! (Another way of saying: yes, you have interested readers). [wink]


Thanks - it's always motivating and refreshing to know someone else is interested [smile]

Yes, structures will let you specify any memory layout you wish - packing, padding, unions, and so on are all on the list. Unions might not appear until a ways down the road, though, depending on my whims.
August 28, 2008 02:44 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement