[Oberon] Life without local procedures
chris at cfbsoftware.com
Sat Feb 24 02:40:57 CET 2018
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Richard Hable
> Sent: Saturday, 24 February 2018 9:31 AM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] Life without local procedures
> > However, what I would be really interested to know is in what
> > circumstances you would *not* make a procedure local if it *could*
> be made local.
> I think, the main criteria should not be, if it is technically
> possible to make a procedure local because it is only used in one
> other procedure. Instead, the main question should be whether a
> procedure logically belongs to a single other procedure or is
> independent enough to be (potentially) reused elsewhere.
> Of course, if a procedure is written to use declarations of the
> surrounding procedure, the programmer has already decided to
> implement it in a way that it is only usable within this procedure.
That is precisely what triggered the discussion about the relevance of local procedures. Since the recent (2016) change to the Oberon language that disallows access to intermediate objects (not just variables) these use-cases no longer exist.
> But also if a procedure is technically independent of the calling
> procedure and could therefore be moved outside, it may make
> assumptions which only make sense in the context of the caller. Also
> then it should be made local to clearly state its limited
Can you point to an example in Project Oberon 2013 which clearly illustrates what you mean by 'it may make assumptions which only make sense in the context of the caller'. Alternatively, if no example exists, where you think it should have been done and why?
More information about the Oberon