Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug with unset variables



On Sun, Nov 22, 2020 at 10:00 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Felipe Contreras wrote on Sat, Nov 21, 2020 at 19:20:56 -0600:
> > On Wed, Nov 18, 2020 at 4:45 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
> >
> > > Do not argue about a person.  Argue about the technical matter at hand.
> >
> > That's what I did. The technical matter was being ignored.
> >
> > > What are A and B?
> >
> > I already explained this multiple times:
> >
> > A: unset foo
> > B: foo = nil
>
> And in Python, A is «del foo»; B is «foo = None»; and they aren't
> equivalent.  Actually, more precisely, Python doesn't even *have* a B,
> because Python doesn't have a syntax for declaring a variable without
> a value.  (When you write «foo = None», that «None» is not implicitly
> provided by the language.)

Are your A and B functionally the same?

No.

Are my A and B functionally the same?

Yes.

Those are undeniable facts.

> However, I don't see how any of this is an argument in favour of the
> behaviour change you proposed.  Other languages' behaviours be what they
> may, they're unlikely to be a good enough reason to break backwards
> compatibility.  (For instance, I don't think a proposal to disable null
> elision would be accepted, due to backwards compatibility concerns,
> regardless of how few other languages do null elision.)

I made the claim and I've substantiated it. Others disagreed with the
claim, and argued against it.

If you don't see how the fact that virtually all languages do the same
thing as Bash and ksh is relevant, then don't argue against the claim.

But my claim still stands.

> > > Why does the Python example not use «del» as the "unset" operation?
> >
> > Because it doesn't do the same thing as unset.
> >
> > In shell, this leaves foo declared in a local scope:
> >
> >   local foo # declare
> >   unset foo # unset
> >
> > In Python, this doesn't:
> >
> >   foo = None # declare
> >   del foo # undeclare
> >
> > They are *not* functionally the same thing.
>
> In Python, the "declare" operation would be just «pass», or more
> precisely, the removal of any «global foo» declarations… but, again,
> unless this Python discussion somehow bears on a proposed change to zsh,
> I'm not interested in continuing it.

No. That's not how you declare local variables in Python.

If you are not interested in continuing it then don't argue against it.

Either argue against my claim or don't, but you can't have your cake
and eat it too.

Cheers.

-- 
Felipe Contreras




Messages sorted by: Reverse Date, Date, Thread, Author