Sign in to follow this  
ApochPiQ

Unity RFC: Epoch Programming Language, Release 12

Recommended Posts

For the last few years, I've been hacking (on and off) on a programming language project called Epoch. Epoch began right here on GDNet as an experiment in designing a forward-thinking language for rich abstraction and powerful computational modeling. Despite the fact that I have had far less time to dedicate to this project than I would like, progress has been steady (albeit slow!) and Release 12 of the language is now available.
[list]
[*][url="http://code.google.com/p/epoch-language/wiki/Release12Notes"]Release Notes[/url]
[*][url="http://code.google.com/p/epoch-language/downloads/detail?name=EpochRelease12Source.zip&can=2&q="]Complete source code (VS2010 format)[/url]
[*][url="http://code.google.com/p/epoch-language/downloads/detail?name=EpochRelease12.exe&can=2&q="]Windows runtime binaries[/url]
[/list]

Epoch still has a ways to go before it is truly production-ready, but even now, the language is reasonably capable and can be used for simple Win32 applications with no problems. (This is underscored by the Era prototype IDE for the language, which is written in Epoch, and included in the distribution.)

For the curious, here's a simple Epoch program:

[code]fib : 0 -> 1
fib : 1 -> 1
fib : integer n -> integer f = fib(n - 1) + fib(n - 2)

deep_thought : -> integer answer = 0
{
integer a = fib(5)
integer b = fib(8)
answer = a + b
}

entrypoint :
{
integer the_answer = deep_thought()
print(the_answer)
}[/code]


I'm very interested in community feedback on all aspects of the language.
[list]
[*]How does the syntax strike you?
[*]Does the language seem interesting? As a theoretical project? As it currently exists?
[*]Would you find the concepts behind Epoch to be useful for your work?
[*]What kinds of things would you like to see in a language like this?
[*]What would motivate you to try it out?
[/list]

Despite its age, Epoch is still a relatively young and malleable project. I hope to be able to turn it into a truly great language, and I appreciate the community's part in helping make that happen.

Share this post


Link to post
Share on other sites
"How does the syntax strike you?"

It looks like some kind of functional language? (I didn't use any that kind of language before).
I'm confused by its typing. Is it strong typing, or weak typing, or hybrid?
fib:0 -> 1, no type? For other part, with strong type integer?

"What would motivate you to try it out?"

1, Giant commercial companies are using it.
and 2, Community support
and 3, Some successful productions are written in it.

Share this post


Link to post
Share on other sites
Epoch is a procedural language at heart, but it does draw a lot of inspiration from functional languages. I plan to support pure functional programming as an optional subset of the language, with compile-time enforcement of immutability (or contained mutability) and other features familiar to functional programmers.

The type system is strong and static; all types are known at compile time, and types never change unless explicitly casted. However, type annotation is optional in many contexts, because Epoch provides a type inference engine to deduce the types of most expressions in the language.

Share this post


Link to post
Share on other sites
Calls to fib() with an argument of 0 match the first pattern, and return 1; similarly with calls with an argument of 1. This can be determined in some cases statically at compile time, in which case the calls are directly made to the appropriate overload; other cases must be detected at runtime, which will first check for the correct overload to resolve to, and then try the default case overload if none of the special cases match. This provides a basic recursive pattern match with a valid base case for termination.

Share this post


Link to post
Share on other sites
Pattern matching on primitive types is equality-based, yes. I haven't settled on a mechanism for type-decomposition in pattern matching largely because I haven't settled on a lot of details of the type system yet :-)

Share this post


Link to post
Share on other sites
Note: I haven't had time to examine the code, or deeply examine the website, so apologies if any of these questions are too obvious. Nor am I particularly trying to be nit-picky, I'm sure you're aware of some of these.

[quote]
How does the syntax strike you?
[/quote]
I like the idea, but there does seem to be heavy historical precedent that programmers like a certain syntax. The following thoughts struck me:

Is assume it is currently not possible to omit the "variable name" of the return value. It would be nicer to be able to write:
[code]
fib : integer n -> integer = fib(n - 1) + fib(n - 2)
[/code]

Is there some syntactic (or other) restriction that prevented you from writing deep_thought like so?
[code]
deep_thought : -> integer answer = fib(5) + fib(8)
[/code]
Perhaps you wrote it long hand just to show more examples of complex functions.

It also appears that you are forced to declare (and initialise) the "result" variable, which forces it to be in scope for the entire function, which might cause bugs where it is unintentionally used in the function body (for example, having the "return" variable named something like "i"). Have you considered a visual basic style "assign to the function name to set the return value"?

Is it possible to early return from a function? Maybe you have a list of example programs or the syntax somewhere on the site, but I didn't find it.

The syntax for a parameterless function is a little poor, the colon followed by arrow do not look great together.

Share this post


Link to post
Share on other sites
Anonymous returns are possible; they look like this:

[code]add : integer a, integer b -> a + b[/code]

The reason that an anonymous return cannot be used in the fib example is because the type inference engine cannot determine that all possible values given to fib() will recurse down to the base case, and therefore cannot infer that the return type of the general case overload is integer, even though the two base case overloads are integer return type.

deep_thought was written longhand just to show how it could be done; there is no reason why it couldn't be:

[code]deep_thought : -> fib(5) + fib(8)[/code]


Variable name shadowing is prohibited in Epoch so there is (IMO) no real risk of accidentally using the return value variable as something else in the function body. I personally don't like the FunctionName=returnvalue syntax, but that's just me; I'm not opposed to changing it if a substantial majority of people find it clearer.


Early returns can be accomplished using the built-in return() statement.

Share this post


Link to post
Share on other sites
I always feel bad for not commenting more, though I don't have much to say...
[quote name='ApochPiQ' timestamp='1335161940' post='4933970']
How does the syntax strike you?
[/quote]

It's fine. I dislike using simply lines as delimiters, and I kinda dislike the current return value form but understand it. It's syntax... *shrug*

[quote]
Does the language seem interesting? As a theoretical project? As it currently exists?
[/quote]

It was a lot more interesting when the focus was auto-parallelization and targetting GPUs and the such. That served as a strong differentiator (for me) as to 'what does Epoch provide that I can't nicely get with ____'.

[quote]
Would you find the concepts behind Epoch to be useful for your work?
[/quote]

Not really, but I also don't have a lot of experience with GPU processing and I would be hesitant to have a developing language be my first entry there.

[quote]
What kinds of things would you like to see in a language like this?
[/quote]

I like seeing progress, even if it makes me sad at the lack of my own. I like seeing differentiation. Lots of languages can do the basic things in a cute manner. What hard things can it do for me?

[quote]
What would motivate you to try it out?
[/quote]

Tons more free time and motivation. And if I had a problem that it was well suited for enough for me to learn it and risk the cutting edge concerns.

Share this post


Link to post
Share on other sites
Well, the focus is still more or less on parallel processing of various flavors; the problem is it takes a lot of groundwork to make a language rich enough to actually muck around in that space effectively :-)

R13 will have a lot more feature work and hopefully a lot less back-end implementation shuffling. I want to have a basic task system back in place in the space of the next release or 2.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this