[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "procedure" vs. "function"
From: |
Wols Lists |
Subject: |
Re: "procedure" vs. "function" |
Date: |
Sat, 18 Apr 2015 21:36:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
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
- Re: "procedure" vs. "function", (continued)
Re: "procedure" vs. "function", David Nalesnik, 2015/04/18
- Re: "procedure" vs. "function", Jacques Menu, 2015/04/18
- Re: "procedure" vs. "function", David Nalesnik, 2015/04/18
- Re: "procedure" vs. "function", PMA, 2015/04/18
- Re: "procedure" vs. "function", PMA, 2015/04/18
- Re: "procedure" vs. "function", J Martin Rushton, 2015/04/18
- Re: "procedure" vs. "function", PMA, 2015/04/18
- Re: "procedure" vs. "function", J Martin Rushton, 2015/04/18
Re: "procedure" vs. "function",
Wols Lists <=
Re: "procedure" vs. "function", PMA, 2015/04/18
Re: "procedure" vs. "function", Wols Lists, 2015/04/18
Re: "procedure" vs. "function", Jacques Menu, 2015/04/19
Re: "procedure" vs. "function", PMA, 2015/04/19
Re: "procedure" vs. "function", Andrew Bernard, 2015/04/19