Feature suggestions
From Reia
| Contents: | Top - 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z |
|---|
Have a favorite feature in Python, Ruby, Erlang, or your language du jour which you don't see in right now but would like? Feel free to add your suggestions below. Please, add them alphabetically:
B
Branching
Python-like Multiple if statements
if condition1 ... elif condition2 ... end
D
Decorator syntax
Python has this syntax:
@decorator def myfunc(): # do something
It's a functional construct that takes the decorated function as the main argument and produces a new function. Decorators can be chained and can also take parameters:
@decorator1 @decorator2(param1, param2) @decorator3(param1) def myfunc(param1, param2): #do something
Default parameter values
Some syntax ideas:
def myfunc(foo, bar = 42) def myfunc((:foo, _) = bar : 42)
Documentation
Documentation could be written in one of several formats, like Markdown, Textile or reStructuredText.
Documentation as first class language construction could be similar to Python's docstrings:
>>> def foo(bar): ... """ ... Accepts bar and returns bar * 2 ... """ ... return bar * 2 ... >>> foo(5) 10 >>> print foo.__doc__ Accepts bar and returns bar * 2
E
Erlang interface as module
Change the syntax from
io::format(..)
to
erl::io::format(..)
Then allow for namespace removal from a certain context and you have a distributed sandbox.
F
Final Variables
I mean 'final' sort of like Java, sort of like C/++ const. The Reia implementation would be a single-assignment variable name, Erlang style, allowing people to dial-in the amount of rebinding they prefer for their own code.
K
Keyword Arguments
Python supports keyword arguments as seen in other languages like Objective C. Keyword arguments are a pain point in Ruby and would be a useful inclusion into Reia.
Some syntax ideas:
func(1, 2, val2: 3, val1: 4, val3: 5) func(1, 2, val2=3, val1=4, val3=5)
O
Optional Parenthesis into Functions / Methods
Syntax:
1.to_s instead of 1.to_s()
"example".puts instead of "example".puts()
T
Type Checking
Compile time type checking would increase the potential audience by a lot. I think an approach like Boo would be appropriate, where the code looks just like Python, but is type checked, with the option to use run time checking where the programmer chooses with very little fuss.
Influential languages like Lisp and Smalltalk never became mainstream partly because they didn't have type checking. Erlang has some support via Dialyzer - but this was designed post-hoc. Instead the compile-time type system for a language should be one of the foundations on which it rests - as in most of the dominant languages (going back to Fortran and Algol).

