RE: A question about certain language features

new topic     » goto parent     » topic index » view thread      » older message » newer message

> Call-by-reference isn't used much, but when it is, it makes code
> both simpler and clearer: Compare:
>
> swap(A,B)
>
> with our available alternative:
> object tmp
>   tmp = A
>   A = B
>   B = tmp
>
> > > It is complicated feature, I don't need it.
>
> Not at all complicated. And it doesn't cause errors, because (in Pascal, 
> for
> example) it must be specifically and consciously  enabled in the 
> function
> header.

Functional languages don't allow call by reference, because
it can cause unexpected side-effects.  I wonder if Euphoria
borrows from that philosophy?

> > > Variables can not be initialized when declared, that is ok.
> >
> > That may be.  But I did not ask if it was 'ok', I simply
> > asked why it is not allowed.  Is initializing a variable
> > when it is declared a 'bad thing'?  It is supported in other
> > languages I have used, and so I was wondering why not in
> > Euphoria.
>
> If it is a bad thing, then does that not make constant declarations 
> equally
> bad?

I don't know if it is a 'bad thing' or not.  That is what
I'm trying to find out!

Note that the 'standard' definitions of Pascal, Modula-2,
and Oberon, do not allow variables to be initialized when
they are declared, just like Euphoria.  So Professor Wirth
perhaps thinks it is a bad thing?  I have read several of
his books dealing with the mentioned languages, but I have
not been able to find a justification for not allowing
variables to be initialized when declared.

But there must be a reason.  I can't believe it is just an
arbitrary restriction.

> > And to make sure I'm clear - I'm not asking for these
> > features to be added to Euphoria.
> >
> > For instance, I can see why the author would not choose to
> > add a goto to Euphoria.  Many programmers realize that
> > goto's, used unwisely, can cause hard to
> > follow/maintain/prove correct code.
> >
> > I'm simply trying to understand if in general the author
> > feels that call by reference, variable initialization on
> > declaration, and locally declared Euphoria constants are bad
> > things, or would lead to poor programming style, or what
> > have you.
> >
> > If I know why these things are not allowed, who knows,
> > perhaps I will adopt this style for my own use in the other
> > languages I program in.
>
> Other than the goto, I've never seen any textbook that condemns
> these things. All that any of them can do is contribute to code clarity.
> As to why they're not in Euphoria, along with a number of other things
> which would add convenience while improving and simplifying code,
> only Rob can answer.

Thanks for your reply!  Perhaps the author will chime in?
But I can appreciate that he is probably pretty busy,
especially with the new release.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu