Possible Duplicate:
Is there a language out there in which parameters are placed inside method name?
Does a language exist with such a syntax? If not, what are some of the limitations/disadvantages to this syntax in case I want to write a language that supported it?
Some examples:
sort(array, fromIndex, toIndex);
vs
sort(array)from(index1)to(index2);
Method signature would like this:
sort(SomeType[] arr)from(int begin)to(int end){
...
}
Update:
Because there might be some confusion, I'd like to clarify...
I meant this question as a general idea like this (not specific to sorting and possibly using keywords like from
and to
):
In JAVA(like language):
void myfancymethod(int arg1, String arg2){
...
}
myfancymethod(1, "foo");
In imaginary language:
void my(int arg1)fancy(String arg2)method{
...
}
my(1)fancy("foo")method;
if_then_else_
can be used asif x then y else z
, and aninfix 10 if_then_else_
declaration ensures that… else a + b
is parsed as… else (a + b)
and not(… else a) + b
. Simple.