
Scripting Language Syntax Proposal
Well stated, Peter..

---------------------------Brian Lacy"I create. Therefore I am."
Peter/irbrian,
Then,
My point was: boolean is not necessary, contrary to your original assertion. irbrian either mispoke originally or came to his senses...
Regards,
Jeff
[ CodeDread ]
quote:
Original post by irbrian
Oh, and of course I forgot to mention the third necessary type in my previous post -- a boolean type would still be necessary.
Then,
quote:
Original post by irbrian
I think a boolean type should still be included in the language, even if its "syntactic sugar."
My point was: boolean is not necessary, contrary to your original assertion. irbrian either mispoke originally or came to his senses...
Regards,
Jeff
[ CodeDread ]
quote:
Original post by rypyr
If you''re going to add Boolean, I would suggest differentiating between integers and real then. They''re problem domains are different.
quote:
Original post by irbrian I''m not sure I understand why it matters. Could you elaborate?
I guess you''re right. I can''t think of any reason in the language to make a difference. I was thinking how you would do this internally. Do you store everything as doubles? Do you start out as integer representation and then decide at some point to switch to floating-point representation (I guess this would be on a mathematical operation which results in a fractional result, but that sucks for performance).
If everything is stored as doubles internally, that also might suck for simple things like loops, etc performance-wise.
Regards,
Jeff
[ CodeDread ]
quote:That's why my proposal was to use two internal variables for each 'number' -- a long or integer, and a float or double. I was also thinking a good method might be to use pointers, so that if the current number value is a whole number (1, -3, 567) the float/double pointer could be set to null and the allocated memory released. But I don't know if this would help or hinder in terms of memory usage and performance.
Original post by rypyr
I guess you're right. I can't think of any reason in the language to make a difference. I was thinking how you would do this internally. Do you store everything as doubles? Do you start out as integer representation and then decide at some point to switch to floating-point representation (I guess this would be on a mathematical operation which results in a fractional result, but that sucks for performance).
If everything is stored as doubles internally, that also might suck for simple things like loops, etc performance-wise.
Edit: Come to think of it, it wouldn't really matter.. a pointer is always 32-bits, isn't it? The only time it would matter then is if you were using longs and doubles for the split-number types.
[edited by - irbrian on April 26, 2004 12:48:07 PM]
---------------------------Brian Lacy"I create. Therefore I am."
quote:
Original post by irbrian
That''s why my proposal was to use two internal variables for each ''number'' -- a long or integer, and a float or double. I was also thinking a good method might be to use pointers, so that if the current number value is a whole number (1, -3, 567) the float/double pointer could be set to null and the allocated memory released. But I don''t know if this would help or hinder in terms of memory usage and performance.
I think the bigger performance hit will be to figure out which one is active for every mathematical expression, here''s some easy rules:
int1 + int2 = int3
int1 - int2 = int3
int1 * int2 = int3
int1 / int2 = (int1 % int2 ? float3 : int3)
int1 % int2 = int3
int1 op float2 = float3
float1 op float2 = float3
(where op is +, -, *, /)
However, if the floating point number has zero fractional part, do you then convert it back to an int???
Regards,
Jeff
I
[ CodeDread ]
quote:Actually, it does. It was introduced in C99.
Original post by rypyr
C doesn''t have a boolean type for cripe sakes!
@irbrian:
No collection types?
quote:No:
Original post by rypyr
int1 / int2 = (int1 % int2 ? float3 : int3)
int1 / int2 => int3float1 / int1 => float2int1 / float1 => float2
quote:No.
However, if the floating point number has zero fractional part, do you then convert it back to an int?
quote:Boolean is necessary if your ''if'' statements only allow boolean values. Smalltalk, for instance, has this property (because if there is no boolean, there''s no receiver you can pass your code block to).
Why is boolean is not necessary if you have "number"? C doesn''t have a boolean type for cripe sakes!
Python has received criticism for the values it chooses to interpret as ''false'' in an if statement. Should an empty list be a negative value? What if you write a function that returns None if an operation can''t be performed or returns a list of some values that could be empty? What if you want to replace a function that returns a list with a generator? (generator objects are never false)
---New infokeeps brain running;must gas up!
I think that your script is getting so big that i think that your missing the point... scripting is supposed to ease off some pain instead of create more pain... i dunno to me it looks to me like i would use c++ rather than that scripting language.
Actual Linux penguins were harmed in the making of this message.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement