apoch / epoch-language

Home of the Epoch Programming Language Project
Other
72 stars 3 forks source link

Better function definition syntax #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider replacing function definition syntax:

foo : integer param1, string param2 -> boolean return = false
{
    // Takes two parameters (integer and string respectively)
    // Returns a boolean initialized to false
}

bar :
{
    // Takes no parameters, returns void
}

baz : integer x
{
    // Takes one parameter of type integer
}

quux : -> integer ret = 42
{
    // Takes no parameters, returns an integer initialized to 42
}

Actual syntax is open to discussion.

Original issue reported on code.google.com by don.ap...@gmail.com on 15 Feb 2012 at 8:15

GoogleCodeExporter commented 9 years ago
I'm working on de-parenthesizing the function definition syntax. Adding the = 
syntax for returns will be rolled into improving the variable initializer 
syntax (see Issue 135).

Original comment by don.ap...@gmail.com on 18 Feb 2012 at 9:24

GoogleCodeExporter commented 9 years ago
This is implemented and committed. I still need to fix a random bogus parser 
failure that happens when you end a file with a function that has no code body; 
trying to figure out a good solution.

Original comment by don.ap...@gmail.com on 18 Feb 2012 at 1:28