lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "procedure" vs. "function"


From: PMA
Subject: Re: "procedure" vs. "function"
Date: Sat, 18 Apr 2015 17:11:42 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101227 Iceape/2.0.11

Wols Lists wrote:
On 18/04/15 19:56, PMA wrote:
AFAIK, of our major ancestor languages, only Pascal insisted on a
literal working
function-vs-procedure distinction. Did Wirth ever defend this insistence
(as more
than a track-keeping enforcer re value-outputting vs
non-value-outputting code)?

Actually, so did Fortran, I believe.

Note my earlier comment that a function was defined as having a return
value with no side effects. That then permits aggressive compiler
optimisation - if a function is repeatedly called with the same
argument, the compiler can stash the result of the first call away, and
replace subsequent calls with a lookup table. (And given that Fortran
was meant to be fast and maths-like, that behaviour was actually very
sensible ... :-)

But because programmers were bad at writing "proper" functions, this
caused too many bugs and I think it just became accepted that functions
have side effects and such optimisation was not a good idea.

Cheers,
Wol

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user

Aha.  So the improper-er their code got, the tougher time
compilers had trying to -- as Martin says -- "throw it out".

All told, is there now any real need _not_ to use the terms
"function" and "procedure" interchangeably?  That is, any
real need to try to enforce such a distinction?  The terms
are conflated, everybody knows, and there's no problem.

(No response expected -- at this point I'm just ranting.)
PMA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]