On 3.10.2012 19:58, Andy wrote:
> Additional operators cannot be defined by the user in VHDL. Existing operators can be redefined (overloaded) for additional data types, etc.
>
> Off the top of my head, the only difference between an operator and an equivalent function are the infix vs postfix notation of the arguments.
Why cannot we say that some build-in functions may be written in infix
notation? Lisp teachers say that there are many different notations in
mathematics, even wrapping the argument for square root, so Lisp puts
the end to this jumble and uses only one. And everything is function in
Lisp. But, do they mean that everything was a function and they have
just fixed a notation or choosing another notation changes a category of
your object? Is operator vs. function a syntactic category?
functional (Lisp) notation: f(a,b)
OOP method call notation: a.f(b)
operator (infix) notation: a f b
?
Scala guys, who merged OOP with functional paradigm, explained that
a.+(b) is essentially the same and can be written as a + b
To me, these three are the same thing. So, I do not understand why they
are called operations in one case and functions in another.
> A side effect of expression evaluation also provides a difference in the way operators and functions are executed. Operators in expressions can be executed in different orders based on rules defined in the standard. For instance, the expression: A+B+C can be evalutated in any order, but the expression: "+"(a, "+"(b, c)) must be evaluated in the order written. Note that synthesis may re-order the operations during optimization anyway.
>
> Andy
>
Do you compare A+B+C order against "+"(a, "+"(b, c)) intentionally to
mislead people from the A+(B+C) comparison to show that functions may
have parenthesis and thus are different? Actually, VHDL specifies the
order of operator evaluation as well as Scheme interpreter, that
normally evaluates operands in applicative order applies lazy evaluation
to "special forms". But, as everything in Lisp, they are still
functions. So, being a function or operator is not a syntactic category.
Am I right?
|