D - Idea I had while coding, not sure if it's unrealistic in a strongly type language...
- Bradeeoh (20/20) Aug 28 2001 If so, please tell me how unrealistic, just throwing out the idea.
- Dan Hursh (11/40) Aug 28 2001 Actually, when I read the spec the first time I got the idea that:
- nicO (6/53) Sep 01 2001 Maybe we could introduice new operator as '.' (dot) or 'concat'. So
- kaffiene (1/19) Sep 02 2001 ^ is already used in C.
- Dan Hursh (11/34) Sep 02 2001 For that matter, ** won't work because the is already an infix and
- Axel Kittenberger (4/8) Sep 02 2001 C is already broken in this regard:
- Walter (2/22) Sep 01 2001
If so, please tell me how unrealistic, just throwing out the idea. Built-in array concatination. byte[] b = new byte[3]; byte[] c = new byte[5]; byte[] d = b + c; ( d is now a new byte[], an empty byte[8] ) int[] e = new int[10]; d = c + e; // error - can't mix byte[] and int[] The idea is simple. It just came up while working and I hit a particularly nasty pocket of objects. Of course, libraries could provide this sevice (not this nicely without operator overloading...) and I've written my own libraries in both C++ and Java to accomplish it. But instead of calling functions, why not treat arrays like Strings as far as simple '+' concatination goes? I will admit that I didn't check the language spec before posting this because I'm working and I can't take much time out. I don't REMEMBER it being there... if it is already, I applaud Walter once again and return to work gracefully. If not, then any thoughts? -Brady
Aug 28 2001
Bradeeoh wrote:If so, please tell me how unrealistic, just throwing out the idea. Built-in array concatination. byte[] b = new byte[3]; byte[] c = new byte[5]; byte[] d = b + c; ( d is now a new byte[], an empty byte[8] ) int[] e = new int[10]; d = c + e; // error - can't mix byte[] and int[] The idea is simple. It just came up while working and I hit a particularly nasty pocket of objects. Of course, libraries could provide this sevice (not this nicely without operator overloading...) and I've written my own libraries in both C++ and Java to accomplish it. But instead of calling functions, why not treat arrays like Strings as far as simple '+' concatination goes? I will admit that I didn't check the language spec before posting this because I'm working and I can't take much time out. I don't REMEMBER it being there... if it is already, I applaud Walter once again and return to work gracefully. If not, then any thoughts? -BradyActually, when I read the spec the first time I got the idea that: array0 = array1 + array2 for array's of the same size (that was required) meant: for(int i=0; i < array.length; i++) array0[i] = array1[i] + array2[i]; and I figured it was good that at least array addition would look like addition. When trying to verify my belief I reread the spec and mournfully convinced myself that it was array concatenation. I guess I'd like to know which is it. Dan
Aug 28 2001
Dan Hursh a écrit :Bradeeoh wrote:Maybe we could introduice new operator as '.' (dot) or 'concat'. So introduice some other built-in operator. C introduice too few operator, we should add '**' or '^' for power. nicO nicOIf so, please tell me how unrealistic, just throwing out the idea. Built-in array concatination. byte[] b = new byte[3]; byte[] c = new byte[5]; byte[] d = b + c; ( d is now a new byte[], an empty byte[8] ) int[] e = new int[10]; d = c + e; // error - can't mix byte[] and int[] The idea is simple. It just came up while working and I hit a particularly nasty pocket of objects. Of course, libraries could provide this sevice (not this nicely without operator overloading...) and I've written my own libraries in both C++ and Java to accomplish it. But instead of calling functions, why not treat arrays like Strings as far as simple '+' concatination goes? I will admit that I didn't check the language spec before posting this because I'm working and I can't take much time out. I don't REMEMBER it being there... if it is already, I applaud Walter once again and return to work gracefully. If not, then any thoughts? -BradyActually, when I read the spec the first time I got the idea that: array0 = array1 + array2 for array's of the same size (that was required) meant: for(int i=0; i < array.length; i++) array0[i] = array1[i] + array2[i]; and I figured it was good that at least array addition would look like addition. When trying to verify my belief I reread the spec and mournfully convinced myself that it was array concatenation. I guess I'd like to know which is it. Dan
Sep 01 2001
^ is already used in C.Actually, when I read the spec the first time I got the idea that: array0 = array1 + array2 for array's of the same size (that was required) meant: for(int i=0; i < array.length; i++) array0[i] = array1[i] + array2[i]; and I figured it was good that at least array addition would look like addition. When trying to verify my belief I reread the spec and mournfully convinced myself that it was array concatenation. I guess I'd like to know which is it. DanMaybe we could introduice new operator as '.' (dot) or 'concat'. So introduice some other built-in operator. C introduice too few operator, we should add '**' or '^' for power.
Sep 02 2001
kaffiene wrote:>For that matter, ** won't work because the is already an infix and binary * operator. x ** y => x * (*y) I agree with the idea though. I like perl because of it's liberal use of infix and unary operations. I like C++ because it let me do the same, but it would be nice to have more operator symbol at my disposal, and to be and to mess with precedence. Since before first grade we are taught infix operations. They feel much more natural for anything remotely numeric. Dan^ is already used in C.Actually, when I read the spec the first time I got the idea that: array0 = array1 + array2 for array's of the same size (that was required) meant: for(int i=0; i < array.length; i++) array0[i] = array1[i] + array2[i]; and I figured it was good that at least array addition would look like addition. When trying to verify my belief I reread the spec and mournfully convinced myself that it was array concatenation. I guess I'd like to know which is it. DanMaybe we could introduice new operator as '.' (dot) or 'concat'. So introduice some other built-in operator. C introduice too few operator, we should add '**' or '^' for power.
Sep 02 2001
For that matter, ** won't work because the is already an infix and binary * operator. x ** y => x * (*y)C is already broken in this regard: x /* y => x / (*y) Right? No, it's a comment :o) - Axel
Sep 02 2001
It's already there in the language <g>. -Walter Bradeeoh wrote in message <9mfme5$v1g$1 digitaldaemon.com>...If so, please tell me how unrealistic, just throwing out the idea. Built-in array concatination. byte[] b = new byte[3]; byte[] c = new byte[5]; byte[] d = b + c; ( d is now a new byte[], an empty byte[8] ) int[] e = new int[10]; d = c + e; // error - can't mix byte[] and int[] The idea is simple. It just came up while working and I hit a particularly nasty pocket of objects. Of course, libraries could provide this sevice (not this nicely without operator overloading...) and I've written my own libraries in both C++ and Java to accomplish it. But instead of calling functions, why not treat arrays like Strings as far as simple '+' concatination goes? I will admit that I didn't check the language spec before posting this because I'm working and I can't take much time out. I don't REMEMBER it being there... if it is already, I applaud Walter once again and return to work gracefully. If not, then any thoughts? -Brady
Sep 01 2001