What are the operators available in tlcore? If we are loading up the integer library, we should provide the operations therein, as in the five operators. Is this done?
-
cartesianprogramming
Reply
What are the operators available in tlcore? If we are loading up the integer library, we should provide the operations therein, as in the five operators. Is this done?
jarro2783 01:29 on 2010/08/27 Permalink |
I don’t understand the question.
tlcore has no built in operators, they all come through loading the integer library and declaring things in the header. Are you wanting some of this to be automatic?
To which five operators are you referring? There are plenty that we could have, all the arithmetic and comparison operators, we could have bitwise operators too. It’s partly a question of how we can implement these with a minimum of typing too.
cartesianprogramming 04:08 on 2010/08/27 Permalink |
I think that there should be a default set of operators. We can always use a flag to turn these on and off. For integers, at the minimum, +, -, *, /, %. For comparison, we have a problem with the angle brackets, we could use ge, gt, le, lt.
cartesianprogramming 05:01 on 2010/08/27 Permalink |
Parsing negative numbers is also problematic if we are not using the intmp interface. I propose that we do the same as in Haskell, and use the tilde (~) to indicate a negative number. That way there will be no confusion between ~3 (negative-three) and -3 (the negation operator applied to three).
jarro2783 04:04 on 2010/08/30 Permalink |
I forgot about the angle brackets. Although only < is a problem. Using tilde is a good idea. I think having a default set of operators is a good idea too. We should come up with a reasonable set of associativities and precedences and allow them to be redefined.