Recent

Author Topic: operator overloading  (Read 4682 times)

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: operator overloading
« Reply #15 on: September 12, 2021, 12:55:06 pm »
What's PXSC? […]
Pascal eXtensions for Scientific Computation. A dialect developed by staff at the Institute for Applied Mathematics at the University of Karlsruhe (Germany).

Thanks for that. I was aware of Perl6 and Seed7 allowing precedence etc. to be specified, but not that one.

My tentative solution to the "what is an acceptable operator?" question is to consider what is effectively defined as being a letter by Unicode. Granted that there might be exceptions, e.g. nobody in their right mind would define π as an operator, while × could reasonably be reserved as an operator even if deprecated.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Kays

  • Hero Member
  • *****
  • Posts: 575
  • Whasup!?
    • KaiBurghardt.de
Re: operator overloading
« Reply #16 on: September 12, 2021, 01:22:58 pm »
My tentative solution to the "what is an acceptable operator?" question is to consider what is effectively defined as being a letter by Unicode. Granted that there might be exceptions, e.g. nobody in their right mind would define π as an operator, while × could reasonably be reserved as an operator even if deprecated.
Well, of course you can use π as an operator, such as in relational algebra. In the end operator is just a fancy word for function, the difference being how to notate function application, whether it’s functionName(parameterA, parameterB) or parameterA functionName parameterB [in combination with a well-defined ruleset of operator precedence in the case of infix notation].
« Last Edit: September 12, 2021, 01:31:05 pm by Kays »
Yours Sincerely
Kai Burghardt

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: operator overloading
« Reply #17 on: September 12, 2021, 02:19:14 pm »
My tentative solution to the "what is an acceptable operator?" question is to consider what is effectively defined as being a letter by Unicode. Granted that there might be exceptions, e.g. nobody in their right mind would define π as an operator, while × could reasonably be reserved as an operator even if deprecated.
Well, of course you can use π as an operator, such as in relational algebra. In the end operator is just a fancy word for function, the difference being how to notate function application, whether it’s functionName(parameterA, parameterB) or parameterA functionName parameterB [in combination with a well-defined ruleset of operator precedence in the case of infix notation].

But that's Π, not π, i.e. case is significant. But I agree that my example is a bit naff, since of course pi (irrespective of case) is "letter like" so a naive rule of thumb would suggest that it shouldn't be an operator... while you've provided an example where it is.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Kays

  • Hero Member
  • *****
  • Posts: 575
  • Whasup!?
    • KaiBurghardt.de
Re: operator overloading
« Reply #18 on: September 12, 2021, 04:34:06 pm »
But that's Π, not π, i.e. case is significant. […]
Yeah, the WP article is a little inconsistent: further down in text it’s small π. The DB class I attended consistently used small π, so I think lower-case π is “correct”.

I think it gets actually weird though if you’re handling various “same” character representations, such as U+00FC “ü” versus combining umlaut with “u”, or if you have other means of distinguishing characters.
Yours Sincerely
Kai Burghardt

MarkMLl

  • Hero Member
  • *****
  • Posts: 6686
Re: operator overloading
« Reply #19 on: September 12, 2021, 07:28:30 pm »
Definitely agree about the risk from "sameness", hence my comment about x (or strictly ×) possibly being deprecated.

Your choice of ü as an example is a particularly good one, since if a development environment allowed characters such as ÷ it would be entirely reasonable for this to be generated by an overstrike i.e. the user enters something like :<backspace>- (which was a scheme that worked surprisingly well for early APL). And while that might work for English speakers whose use of combining sequences is extremely infrequent, it would almost certainly confuse every user who was used to having a  compose key.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018