Is there a language that allows this syntax: add(elements)at(index);
- by c_maker
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;