[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: (not) handling new programming idioms with grace
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 25 Jul 2018 13:16:47 -0300
> On Wed, Jul 18, 2018 at 11:55 PM, Roberto Ierusalimschy <
> roberto@inf.puc-rio.br> wrote:
>
> > It is not by chance that Lua avoids too many syntactical constructs.
> > They are hard to be represented in the C API.
> >
>
> If "with" is syntax sugar on top of scoped vars then a representation in
> the C API isn't needed.
>
> The benefits of "with" syntax are related to readability: 1) it's clear by
> code structure that a resource is open, and 2) named variables can be
> elided in many cases, e.g.:
As hard as I try, I don't see why 'with foo() as x' is clearer than
'local scoped x = foo()'. Both have a very clear and unique mark
('with' vs 'scoped'). Moreover, 'with' has different meanings in
some other languages, so it can be even more confusing.
'with foo()' might be slightly better than 'local scoped _ = foo()',
but I don't think it is worth creating a new construct (plus a new
reserved word) just to avoid the '_'.
As I already explained, the more you insist on 'with', the less I like
the general idea. If 'with' is really superior to 'local scoped', there
is something I am not understanding correctly about the whole stuff. I
will not try to solve a problem I am not understanding.
-- Roberto
- References:
- (not) handling new programming idioms with grace, John Belmonte
- Re: (not) handling new programming idioms with grace, Dibyendu Majumdar
- Re: (not) handling new programming idioms with grace, Roberto Ierusalimschy
- Re: (not) handling new programming idioms with grace, John Belmonte
- Re: (not) handling new programming idioms with grace, Viacheslav Usov
- Re: (not) handling new programming idioms with grace, John Belmonte
- Re: (not) handling new programming idioms with grace, Roberto Ierusalimschy
- Re: (not) handling new programming idioms with grace, Javier Guerra Giraldez
- Re: (not) handling new programming idioms with grace, Roberto Ierusalimschy
- Re: (not) handling new programming idioms with grace, John Belmonte