Is there a language that allows this syntax: add(elements)at(index);
Posted
by
c_maker
on Programmers
See other posts from Programmers
or by c_maker
Published on 2011-11-18T21:34:11Z
Indexed on
2011/11/19
10:15 UTC
Read the original article
Hit count: 159
language-design
|syntax
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;
© Programmers or respective owner