Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

A new, better syntax...

Name: Anonymous 2008-04-10 0:39

Came up with this great idea while I was reading SICP today, what does /prog/ thinK?


As I was calling the method .subString I was thinking to myself how nice it would be if function parameters could have their own scope.

So instead of calling.

c.substring(1, c.length()-1)

You could call

c.substring(1, length-1)

And for the length variable in the string class you would do something like.

FunctionScope int length;

Though a similar syntax you could get rid of the common static identifier in dot net.

For example maybe for functions where an enumerator is wanted.
add(String a, Type.visibletrue)

could be

add(String a, visibletrue)

The latter syntax probably should need nothing but that, because if you are passing an enumerator and the only two valid values are static variables then it should be able to correctly determine the type without the Type. in front.

Obviously this could probably be done in a more correct or better fashion, but I think it is an idea that has some merit to it.
Terra

Name: Anonymous 2008-04-10 1:19

It's less clear to the reader

Name: Anonymous 2008-04-10 1:40

I don't like the concept of implicitly changing namespaces like that.

Name: Anonymous 2008-04-10 2:13

Or you could call c.substring(1, -1) like Perl.

Name: Anonymous 2008-04-10 3:47

D has a syntax to use "length" in an array.


// possibly not valid, but you'll get the point
int[] a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int[] b = a[2 .. length - 3];

Name: Anonymous 2008-04-10 3:49

>>1
i ___fukken___ """rage'd"""

One word.  The forced indentation of code.  Thread over.

Name: Anonymous 2008-04-10 3:58

function parameters could have their own scope.
You have the wording wrong, this implies that variables created within the caller's ( ) have a different scope. I think what you meant is method parameters have the first scope as the scope of their class.

Name: Anonymous 2008-04-10 4:33

Not needed in Haskell, anyway.
We use short variable names in such situations,
also we have sane function/operator precedence.

Name: Anonymous 2008-04-10 8:36

>>1
Troll.

Name: Anonymous 2008-04-10 9:05

This is a stupid idea. You're stupid.

back to /b/, please

Name: Anonymous 2008-04-10 9:05

>>9
and we have been trolled constantly.

Name: Anonymous 2008-04-10 9:32

Go pitch this idea to Perl developers, they'll love it.

Name: Anonymous 2008-04-10 10:03

>>12
By developers you mean, like, toy language users.

Name: Anonymous 2008-04-10 10:08

>>13
That is the definition of developers.

Name: Anonymous 2008-04-10 10:41

Sepples already does something like that, only in reverse (ADL).

Name: Anonymous 2008-04-10 11:15

>>14
Sans, like, the poor articulation, man.

Name: Anonymous 2009-03-06 13:56

While explaining the system Southwest warned The?

Name: Anonymous 2009-03-06 15:10

reader new InputStreamReader System in String s.

Name: Sgt.Kabukiman 2012-05-21 14:37

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List