Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"We came. We saw. We kicked its ass." -- Bill Murray, _Ghostbusters_


devel / comp.lang.lisp / Re: Is Lexical Binding The Norm Yet?

SubjectAuthor
* Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
+- Re: Is Lexical Binding The Norm Yet?Jeff Barnett
+* Re: Is Lexical Binding The Norm Yet?Alan Bawden
|`* Re: Is Lexical Binding The Norm Yet?Paul Rubin
| +- Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
| +* Re: Is Lexical Binding The Norm Yet?Alan Bawden
| |+* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
| ||`* Re: Is Lexical Binding The Norm Yet?Stefan Ram
| || `- Re: Is Lexical Binding The Norm Yet?Alan Bawden
| |`* Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
| | `* Re: Is Lexical Binding The Norm Yet?Alan Bawden
| |  +- Re: Is Lexical Binding The Norm Yet?Stefan Ram
| |  `* Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
| |   `- Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
| `* Re: Is Lexical Binding The Norm Yet?Jeff Barnett
|  +* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|  |`- Re: Is Lexical Binding The Norm Yet?Jeff Barnett
|  `* Re: Is Lexical Binding The Norm Yet?Stefan Monnier
|   +* Re: Is Lexical Binding The Norm Yet?Jeff Barnett
|   |`* Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
|   | +* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |+- Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
|   | |`* Re: Is Lexical Binding The Norm Yet?George Neuner
|   | | `* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |  +* Re: Is Lexical Binding The Norm Yet?George Neuner
|   | |  |`* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |  | `* Re: Is Lexical Binding The Norm Yet?George Neuner
|   | |  |  `* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |  |   +- Re: Is Lexical Binding The Norm Yet?George Neuner
|   | |  |   +* Re: Is Lexical Binding The Norm Yet?Alan Bawden
|   | |  |   |+- Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
|   | |  |   |+- Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |  |   |`* Re: Is Lexical Binding The Norm Yet?Stefan Ram
|   | |  |   | `* Re: Is Lexical Binding The Norm Yet?Stefan Ram
|   | |  |   |  +- Re: Is Lexical Binding The Norm Yet?Stefan Ram
|   | |  |   |  `* Re: Is Lexical Binding The Norm Yet?Alan Bawden
|   | |  |   |   `- Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |  |   `- Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
|   | |  `* Re: Is Lexical Binding The Norm Yet?Stefan Ram
|   | |   `* Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
|   | |    `- Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
|   | `* Re: Is Lexical Binding The Norm Yet?Lars Brinkhoff
|   |  `- Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
|   `- Re: Is Lexical Binding The Norm Yet?Lawrence D'Oliveiro
`* Re: Is Lexical Binding The Norm Yet?Kaz Kylheku
 `- Dynamic scope and parameter objects (was: Is Lexical Binding The Norm Yet?)Stefan Monnier

Pages:12
Re: Is Lexical Binding The Norm Yet?

<7w4jfbrx92.fsf@junk.nocrew.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17858&group=comp.lang.lisp#17858

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
From: lars.spam@nocrew.org (Lars Brinkhoff)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Organization: nocrew
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org>
<871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
Date: Thu, 18 Jan 2024 06:06:33 +0000
Message-ID: <7w4jfbrx92.fsf@junk.nocrew.org>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Cancel-Lock: sha1:WrnCdtK6lpT+Wig5ZWpbnksPpt4=
MIME-Version: 1.0
Content-Type: text/plain
Lines: 13
NNTP-Posting-Host: dcd1db47.news.sunsite.dk
X-Trace: 1705557993 news.sunsite.dk 707 lars@junk.nocrew.org/51.15.56.219:33968
X-Complaints-To: staff@sunsite.dk
 by: Lars Brinkhoff - Thu, 18 Jan 2024 06:06 UTC

Kaz Kylheku wrote:
> By the way, I once made a (proprietary, closed source) Lisp dialect
> which had dynamic scope, but with proper closures!

Didn't Interlisp do that with spaghetti stacks?

"One of the most innovative of the language extensions introduced by
Interlisp was the spaghetti stack. The problem of retention (by
closures) of the dynamic function-definition environment in the presence
of special variables was never completely solved until spaghetti stacks
were invented." The Evolution of Lisp, Steele and Gabriel, 1993.

Well done with your marathon training!

Re: Is Lexical Binding The Norm Yet?

<20240118105941.63@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17863&group=comp.lang.lisp#17863

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Thu, 18 Jan 2024 19:06:43 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <20240118105941.63@kylheku.com>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<7w4jfbrx92.fsf@junk.nocrew.org>
Injection-Date: Thu, 18 Jan 2024 19:06:43 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d2d938dda3e1a6a4011b6cb72d132af7";
logging-data="2858491"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/V/T4jKYVi6/kw+Oqv6TmDGbSvYvkbEqM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:pQE2IaCxy4HLYcGxFHg7Xmu79vc=
 by: Kaz Kylheku - Thu, 18 Jan 2024 19:06 UTC

On 2024-01-18, Lars Brinkhoff <lars.spam@nocrew.org> wrote:
> Kaz Kylheku wrote:
>> By the way, I once made a (proprietary, closed source) Lisp dialect
>> which had dynamic scope, but with proper closures!
>
> Didn't Interlisp do that with spaghetti stacks?

Well, yes. I think I consciously had spaghetti stacks in mind when
working on that implementation.

IIRC (I don't have the code) it may be that the variable frames were
actually just kept in the regular run-time stack, and not dynamically
allocated. Only the closing mechanism created dynamic copies.

Also, I think, when taking a closure, I didn't just blindly replicate
the chain of frames up to the capture delimiter, but flattened it down
to one environment frame.

> "One of the most innovative of the language extensions introduced by
> Interlisp was the spaghetti stack. The problem of retention (by
> closures) of the dynamic function-definition environment in the presence
> of special variables was never completely solved until spaghetti stacks
> were invented." The Evolution of Lisp, Steele and Gabriel, 1993.

Okay, so there was an awareness about spaghetti stacks solving a more
general problem; it wasn't just for the sake of continuations.

So that's what I did in that implementation: a more limited form
of the spaghetti stack technique that wouldn't support resumption
of a continuation, only visibility into dynamic environments.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: Is Lexical Binding The Norm Yet?

<qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17869&group=comp.lang.lisp#17869

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Thu, 18 Jan 2024 23:39:26 -0500
Organization: i2pn2 (i2pn.org)
Message-ID: <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="3972374"; mail-complaints-to="usenet@i2pn2.org";
posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: George Neuner - Fri, 19 Jan 2024 04:39 UTC

On Wed, 17 Jan 2024 23:33:40 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote:

>On Wed, 17 Jan 2024 20:37:43 -0000 (UTC), Kaz Kylheku wrote:
>
>> By the way, I once made a (proprietary, closed source) Lisp dialect
>> which had dynamic scope, but with proper closures!
>
>I’m just a humble Python programmer, but it seems to me there are easier
>ways of doing such things: create and instantiate a class.

Closures ARE objects - the major difference vs conventional OOP being
that closures - at runtime - can associate an arbitrary set of data
with an arbitrary set of functions.

>Then you can define methods that access and update the internal state,
>coupled with a method that says “do the actual work”. You can even manage
>that internal state via assignable “properties”, instead of explicit
>getter/setter method calls.
>
>And for added flavour, if you define a “__call__()” method that does the
>actual work, you can call the class instance as though it were a function.

Programming with closures is more like using "prototype OO". Prototype
systems don't have classes, but rather ANY object can be modified to
change its set of instance data and/or methods, and can be cloned to
create new objects of that same "type".
https://en.wikipedia.org/wiki/Prototype-based_programming

Python OO is class based. Python objects can be modified by
reflection and can be cloned ... but that is not the normal way of
defining and creating objects in Python.

There is a Python library which redefines classes and objects to
enable some prototype like behavior ... but there still is a
distinction between "class" and "object".

Re: Is Lexical Binding The Norm Yet?

<uod249$30h1g$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17870&group=comp.lang.lisp#17870

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.chmurka.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Fri, 19 Jan 2024 05:42:33 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 8
Message-ID: <uod249$30h1g$3@dont-email.me>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 19 Jan 2024 05:42:33 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a99d1106c5a63aadcf4a9426eaf9b9d4";
logging-data="3163184"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/voNDOiSLF7Fo3gITbHUaH"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:tkkT7NZnZVg+foRT4SLEkrXABBM=
 by: Lawrence D'Oliv - Fri, 19 Jan 2024 05:42 UTC

On Thu, 18 Jan 2024 23:39:26 -0500, George Neuner wrote:

> Programming with closures is more like using "prototype OO". Prototype
> systems don't have classes, but rather ANY object can be modified to
> change its set of instance data and/or methods, and can be cloned to
> create new objects of that same "type".

That’s true of Python, too.

Re: Is Lexical Binding The Norm Yet?

<oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17872&group=comp.lang.lisp#17872

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Fri, 19 Jan 2024 12:11:13 -0500
Organization: i2pn2 (i2pn.org)
Message-ID: <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="4033996"; mail-complaints-to="usenet@i2pn2.org";
posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: George Neuner - Fri, 19 Jan 2024 17:11 UTC

On Fri, 19 Jan 2024 05:42:33 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote:

>On Thu, 18 Jan 2024 23:39:26 -0500, George Neuner wrote:
>
>> Programming with closures is more like using "prototype OO". Prototype
>> systems don't have classes, but rather ANY object can be modified to
>> change its set of instance data and/or methods, and can be cloned to
>> create new objects of that same "type".
>
>That’s true of Python, too.

You can clone/copy objects in Python, but - barring use of reflection
- you can't easily change an object's *declaration*: ie. its
properties (data fields) and methods (functions). Those are tied to
the object's class.

In prototype OO you can modify any object to add, delete, change or
replace its data fields or methods. Every object then is a template
for creating new objects having the same set of fields and methods.
[You could say that every object is both a class and an instance of
that class, but really the whole notion of what it means to be a class
or a member thereof disappears.]

Re: Is Lexical Binding The Norm Yet?

<uoeme2$39ohi$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17873&group=comp.lang.lisp#17873

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Fri, 19 Jan 2024 20:35:14 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uoeme2$39ohi$4@dont-email.me>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 19 Jan 2024 20:35:14 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="a99d1106c5a63aadcf4a9426eaf9b9d4";
logging-data="3465778"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18t02YY+TmaKpBwYx/G6cU3"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:0xkgSlFatvQ3kQ17DbiBdfu1+9A=
 by: Lawrence D'Oliv - Fri, 19 Jan 2024 20:35 UTC

On Fri, 19 Jan 2024 12:11:13 -0500, George Neuner wrote:

> On Fri, 19 Jan 2024 05:42:33 -0000 (UTC), Lawrence D'Oliveiro
> <ldo@nz.invalid> wrote:
>
>>On Thu, 18 Jan 2024 23:39:26 -0500, George Neuner wrote:
>>
>>> Programming with closures is more like using "prototype OO". Prototype
>>> systems don't have classes, but rather ANY object can be modified to
>>> change its set of instance data and/or methods, and can be cloned to
>>> create new objects of that same "type".
>>
>>That’s true of Python, too.
>
> You can clone/copy objects in Python, but - barring use of reflection
> - you can't easily change an object's *declaration*: ie. its
> properties (data fields) and methods (functions). Those are tied to
> the object's class.

No they are not.

Re: Is Lexical Binding The Norm Yet?

<prototype-20240120111210@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17878&group=comp.lang.lisp#17878

  copy link   Newsgroups: comp.lang.lisp comp.lang.python
Path: i2pn2.org!rocksolid2!news.neodome.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.lisp,comp.lang.python
Subject: Re: Is Lexical Binding The Norm Yet?
Date: 20 Jan 2024 10:13:40 GMT
Organization: Stefan Ram
Lines: 46
Expires: 1 Dec 2024 11:59:58 GMT
Message-ID: <prototype-20240120111210@ram.dialup.fu-berlin.de>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de bZ5fgMPL6iinXMX0xNiBoAvuWyrFWVMkhz3pVq0wwZIMXK
Cancel-Lock: sha1:5vUMwzwWH0NOgpJYEXIFaStj3BE= sha256:UMkhXDtlqemCgAsfWYy4BF5EZzKaq88+FX4GMffnyQE=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Sat, 20 Jan 2024 10:13 UTC

Newsgroups: comp.lang.lisp,comp.lang.python

Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>On Thu, 18 Jan 2024 23:39:26 -0500, George Neuner wrote:
>>Programming with closures is more like using "prototype OO". Prototype
>>systems don't have classes, but rather ANY object can be modified to
>>change its set of instance data and/or methods, and can be cloned to
>>create new objects of that same "type".
>That’s true of Python, too.

Yes that's true. Forgive me guys if that's too "off topic"
in comp.lang.lisp, but it might not be obvious how to create
an object in Python and then attach fields or methods to it.
So here I humbly submit a small example program to show this.

main.py

from types import *

# create a new object
def counter_object(): pass

# attach a numeric field to the object
counter_object.counter_value = 0

# define a named function
def increment_value( self ): self.counter_value += 1

# attach the named function to the object as a method
counter_object.increment_value = \
MethodType( increment_value, counter_object )

# call the method
counter_object.increment_value()

# attach an unnamed function to the object
counter_object.get_value = \
MethodType( lambda self: self.counter_value, counter_object )

# call that method
print( counter_object.get_value() )

This program will then print "1" and a line terminator.

Newsgroups: comp.lang.lisp,comp.lang.python

Re: Is Lexical Binding The Norm Yet?

<uohdk3$3r4em$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17890&group=comp.lang.lisp#17890

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.nntp4.net!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sat, 20 Jan 2024 21:23:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 5
Message-ID: <uohdk3$3r4em$3@dont-email.me>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me>
<prototype-20240120111210@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 20 Jan 2024 21:23:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e15dac640a9167fb7bc10933baa543b0";
logging-data="4035030"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JZre5DotSq97YrJcFYvOx"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:/aYv703fkypFffgHvCp7/KyJYl4=
 by: Lawrence D'Oliv - Sat, 20 Jan 2024 21:23 UTC

On 20 Jan 2024 10:13:40 GMT, Stefan Ram wrote:

> from types import *

Death to wildcard imports!

Re: Is Lexical Binding The Norm Yet?

<e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17897&group=comp.lang.lisp#17897

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sat, 20 Jan 2024 19:20:46 -0500
Organization: i2pn2 (i2pn.org)
Message-ID: <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com> <uoeme2$39ohi$4@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
logging-data="4187049"; mail-complaints-to="usenet@i2pn2.org";
posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: George Neuner - Sun, 21 Jan 2024 00:20 UTC

On Fri, 19 Jan 2024 20:35:14 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote:

>On Fri, 19 Jan 2024 12:11:13 -0500, George Neuner wrote:
>
>> On Fri, 19 Jan 2024 05:42:33 -0000 (UTC), Lawrence D'Oliveiro
>> <ldo@nz.invalid> wrote:
>>
>>>On Thu, 18 Jan 2024 23:39:26 -0500, George Neuner wrote:
>>>
>>>> Programming with closures is more like using "prototype OO". Prototype
>>>> systems don't have classes, but rather ANY object can be modified to
>>>> change its set of instance data and/or methods, and can be cloned to
>>>> create new objects of that same "type".
>>>
>>>That’s true of Python, too.
>>
>> You can clone/copy objects in Python, but - barring use of reflection
>> - you can't easily change an object's *declaration*: ie. its
>> properties (data fields) and methods (functions). Those are tied to
>> the object's class.
>
>No they are not.

Yes they are.

Python does share some implementation details with prototype systems:
runtime type information (including object structure) is kept as a map
(dict). However, when you modify an object with __addattr__ et al,
the object's *class* information is copied and then modified to create
a new anonymous class, and the object returned is an instance of that
new class. The original class remains unmodified and continues to be
used as long as instances of that class remain.

But Python does not actively promote the notion that objects should be
manipulated in this way. The *preferred* way is to create a new type
is to define a new named class.

In contrast, in a prototype system manipulating an object's structure
and cloning it is the ONLY way to create a new type of object. Every
object IS its own class, so when/if you modify it, you truly are
modifying the class itself.

Re: Is Lexical Binding The Norm Yet?

<uohonn$3sm2o$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17898&group=comp.lang.lisp#17898

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!news.hispagatos.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 00:32:55 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <uohonn$3sm2o$2@dont-email.me>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 Jan 2024 00:32:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="942a1f970482f2e4dbf1b31185d2ff4b";
logging-data="4085848"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+09RJHgmY610nAb1Bo3cHc"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:DkpPU24vCSl1psI33FVWx/hoknI=
 by: Lawrence D'Oliv - Sun, 21 Jan 2024 00:32 UTC

On Sat, 20 Jan 2024 19:20:46 -0500, George Neuner wrote:

> However, when you modify an object with __addattr__ et al,
> the object's *class* information is copied and then modified to create
> a new anonymous class ...

Shut up already. And try this:

class ExampleClass :

def method(self) :
print("I am the true method.")
#end method

#end ExampleClass

def false_method() :
print("I am the impostor method.")
#end false_method

inst1 = ExampleClass()
inst2 = ExampleClass()
inst2.method = false_method

inst1.method()
inst2.method()
del inst2.method
inst2.method()

Output:

I am the true method.
I am the impostor method.
I am the true method.

Re: Is Lexical Binding The Norm Yet?

<rhqoqiljlbmmlb0ke7qc1ifmqgi78o27je@4ax.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17901&group=comp.lang.lisp#17901

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!.POSTED!not-for-mail
From: gneuner2@comcast.net (George Neuner)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sat, 20 Jan 2024 19:54:12 -0500
Organization: i2pn2 (i2pn.org)
Message-ID: <rhqoqiljlbmmlb0ke7qc1ifmqgi78o27je@4ax.com>
References: <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com> <uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com> <uohonn$3sm2o$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: i2pn2.org;
logging-data="4189169"; mail-complaints-to="usenet@i2pn2.org";
posting-account="h5eMH71iFfocGZucc+SnA0y5I+72/ecoTCcIjMd3Uww";
User-Agent: ForteAgent/8.00.32.1272
X-Spam-Checker-Version: SpamAssassin 4.0.0
 by: George Neuner - Sun, 21 Jan 2024 00:54 UTC

On Sun, 21 Jan 2024 00:32:55 -0000 (UTC), Lawrence D'Oliveiro
<ldo@nz.invalid> wrote:

>On Sat, 20 Jan 2024 19:20:46 -0500, George Neuner wrote:
>
>> However, when you modify an object with __addattr__ et al,
>> the object's *class* information is copied and then modified to create
>> a new anonymous class ...
>
>Shut up already. And try this:
>
> class ExampleClass :
>
> def method(self) :
> print("I am the true method.")
> #end method
>
> #end ExampleClass
>
> def false_method() :
> print("I am the impostor method.")
> #end false_method
>
> inst1 = ExampleClass()
> inst2 = ExampleClass()
> inst2.method = false_method
>
> inst1.method()
> inst2.method()
> del inst2.method
> inst2.method()
>
>Output:
>
> I am the true method.
> I am the impostor method.
> I am the true method.

That is not changing the object's declaration at all - it is simply
rebinding a member to a new function in one instance.

Create a new instance of ExampleClass() and it will have the original
method, not the "change" you made to inst2.

How about you try to learn something?

Re: Is Lexical Binding The Norm Yet?

<86y1cjqpei.fsf@williamsburg.bawden.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17902&group=comp.lang.lisp#17902

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bawden.eternal-september.org!.POSTED!not-for-mail
From: alan@csail.mit.edu (Alan Bawden)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sat, 20 Jan 2024 23:30:29 -0500
Organization: ITS Preservation Society
Lines: 66
Message-ID: <86y1cjqpei.fsf@williamsburg.bawden.org>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org>
<871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me>
<qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me>
<oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me>
<e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
<uohonn$3sm2o$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: bawden.eternal-september.org; posting-host="ddef6e23bd7d59c42d69d72840f409cd";
logging-data="74502"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AnO1xX0LBazPpcYiJvmmy"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock: sha1:dfYgJxIcF5m8shkKjRIIm5DEzWg=
sha1:HYokIXkTR+1r5Jr2JJLHJABoZ2c=
 by: Alan Bawden - Sun, 21 Jan 2024 04:30 UTC

Lawrence D'Oliveiro <ldo@nz.invalid> writes:

...

Shut up already. And try this:

Calm down. The point that George was trying to make is that neither
Python nor Common Lisp is a prototype OO system. Prototype OO was once
(in the early 80s) a serious contender for how to design an
object-oriented language. Before Common Lisp had an object system there
were several proposals floating around, some of which were prototype
based. But I don't think any programming language ever actually wound
up using such a system.

It is true that in Python you can do this:

class ExampleClass :
def method(self) :
print("I am the true method.")

def false_method() :
print("I am the impostor method.")

inst1 = ExampleClass()
inst2 = ExampleClass()
inst2.method = false_method

inst1.method()
inst2.method()
del inst2.method
inst2.method()

Output:

I am the true method.
I am the impostor method.
I am the true method.

But consider the following:

Python 3.10.5 (v3.10.5:f37715, Jul 10 2022, 00:26:17) [GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Frob:
... def __len__(self):
... return 17
...
>>> x = Frob()
>>> len(x)
17
>>> x.__len__()
17
>>> x.__len__ = lambda: 23
>>> x.__len__()
23
>>> len(x)
17

Why didn't that work? Because the Python implementors knew that
assigning new methods like that was not the _normal_ way to make objects
with new behaviors. The _could_ have made that work (which would
arguably be more consistent), but in the name of efficiency they chose
not to. In a _true_ prototype system, where all new object behavior
comes from cloning followed by modification, they would not have made
that choice.

- Alan

Re: Is Lexical Binding The Norm Yet?

<20240120204851.491@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17904&group=comp.lang.lisp#17904

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 04:51:15 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <20240120204851.491@kylheku.com>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me>
<prototype-20240120111210@ram.dialup.fu-berlin.de>
<uohdk3$3r4em$3@dont-email.me>
Injection-Date: Sun, 21 Jan 2024 04:51:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="33c09ed4842a7f81f4877f94e0219235";
logging-data="77754"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX181qiJQkObDQiO1aA/OqbK2TFFgk0D1AmM="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:pLI3HReP1j0g+9opcVS/foOFDPE=
 by: Kaz Kylheku - Sun, 21 Jan 2024 04:51 UTC

On 2024-01-20, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On 20 Jan 2024 10:13:40 GMT, Stefan Ram wrote:
>
>> from types import *
>
> Death to wildcard imports!

I was regarded as a maverick/lunatic in the 1990's when, in the context
of C++, I called out that wholesale imports like "using std;" are
an incredibly idea, only suitable at best for throwaway test programs.

Mostly, the C++ world came around to it.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: Is Lexical Binding The Norm Yet?

<20240120205134.250@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17905&group=comp.lang.lisp#17905

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.network!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 04:53:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <20240120205134.250@kylheku.com>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
<uohonn$3sm2o$2@dont-email.me>
Injection-Date: Sun, 21 Jan 2024 04:53:53 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="33c09ed4842a7f81f4877f94e0219235";
logging-data="77754"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+U8Cq+7uP63uqmFRpNSJa/5IH6nhXCnzI="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:d3BxEW85jagmIVQKEI2lXGJ7qZA=
 by: Kaz Kylheku - Sun, 21 Jan 2024 04:53 UTC

On 2024-01-21, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
> On Sat, 20 Jan 2024 19:20:46 -0500, George Neuner wrote:
>
>> However, when you modify an object with __addattr__ et al,
>> the object's *class* information is copied and then modified to create
>> a new anonymous class ...
>
> Shut up already. And try this:

I used Python for a total of about four or five days, yet I
managed to attach a new property at run-time to the object
coming out of Argparse (or whatever that argument parsing
thing is called).

I can't remember exactly why, but it was expedient.
The code was converted from ad-hoc argument parsing to
Argparse, and the technique helped represent some feature
of the original logic.

Python has a mechanism to attach new propeties to objects
dynamically. In that mechanism, their names appear
as strings, but then end up visible in the normal
member access syntax as obj.name.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: Is Lexical Binding The Norm Yet?

<20240120205426.565@kylheku.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17906&group=comp.lang.lisp#17906

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 433-929-6894@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 04:57:09 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20240120205426.565@kylheku.com>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
<uohonn$3sm2o$2@dont-email.me> <86y1cjqpei.fsf@williamsburg.bawden.org>
Injection-Date: Sun, 21 Jan 2024 04:57:09 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="33c09ed4842a7f81f4877f94e0219235";
logging-data="77754"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+7G1Lr0BtDEDiife4riGmnjZSfqZJ9pgk="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:no152LEmz4FMdEw+xy3pBnHVocU=
 by: Kaz Kylheku - Sun, 21 Jan 2024 04:57 UTC

On 2024-01-21, Alan Bawden <alan@csail.mit.edu> wrote:
> Lawrence D'Oliveiro <ldo@nz.invalid> writes:
>
> ...
>
> Shut up already. And try this:
>
> Calm down. The point that George was trying to make is that neither
> Python nor Common Lisp is a prototype OO system. Prototype OO was once
> (in the early 80s) a serious contender for how to design an
> object-oriented language. Before Common Lisp had an object system there
> were several proposals floating around, some of which were prototype
> based. But I don't think any programming language ever actually wound
> up using such a system.

Today, JavaScript is said to be prototype-based. I have no idea where
the goalposts are: is it True Scotsman's prototype-based or not.

(All I know is that I hate every aspect of the approach, in
pretty much any shape. It is a copout from doing the gruntwork of
implementing a proper object system, and that shows at every corner.)

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: Is Lexical Binding The Norm Yet?

<uoi97n$2gjc$2@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17908&group=comp.lang.lisp#17908

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 05:14:32 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <uoi97n$2gjc$2@dont-email.me>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
<uohonn$3sm2o$2@dont-email.me> <86y1cjqpei.fsf@williamsburg.bawden.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 Jan 2024 05:14:32 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="942a1f970482f2e4dbf1b31185d2ff4b";
logging-data="82540"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tF9e4IVet3Wn1ouB6g8SM"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:zmKJnF4ZVRK/hSM9d9GNvGaAtH8=
 by: Lawrence D'Oliv - Sun, 21 Jan 2024 05:14 UTC

On Sat, 20 Jan 2024 23:30:29 -0500, Alan Bawden wrote:

> >>> class Frob:
> ... def __len__(self):
> ... return 17 ...
> >>> x = Frob()
> >>> len(x)
> 17
> >>> x.__len__()
> 17
> >>> x.__len__ = lambda: 23 x.__len__()
> 23
> >>> len(x)
> 17
>
> Why didn't that work?

Not sure what you are saying didn’t “work” in this case. Monkey-patching
the member of the instance does “work”: access the member on the instance,
and you get the monkey-patched value.

Re: Is Lexical Binding The Norm Yet?

<lookup-20240121111504@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17909&group=comp.lang.lisp#17909

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: 21 Jan 2024 10:15:56 GMT
Organization: Stefan Ram
Lines: 8
Expires: 1 Dec 2024 11:59:58 GMT
Message-ID: <lookup-20240121111504@ram.dialup.fu-berlin.de>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com> <uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com> <uohonn$3sm2o$2@dont-email.me> <86y1cjqpei.fsf@williamsburg.bawden.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de wEFPT1heuWGP4+jpQ81LCQG2jXCdEyX15JGdoqZmRkQYwP
Cancel-Lock: sha1:L/ZSS1c3GUoscEHMM+gg4kpblAs= sha256:FCJZUKgl6nLbwlxoS0cOAWK754eEHmk3l62LpZJUhCU=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Sun, 21 Jan 2024 10:15 UTC

Alan Bawden <alan@csail.mit.edu> writes:
>Why didn't that work?

Implicit invocations of special methods are only guaranteed
to work correctly if defined on an object's type, not in
the object's instance dictionary. (See: The Python Language
Reference, Release 3.13.0a0; 3.3.12 Special method lookup).

Re: Is Lexical Binding The Norm Yet?

<len-20240121124048@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17910&group=comp.lang.lisp#17910

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.furie.org.uk!news.samoylyk.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: 21 Jan 2024 11:46:31 GMT
Organization: Stefan Ram
Lines: 21
Expires: 1 Dec 2024 11:59:58 GMT
Message-ID: <len-20240121124048@ram.dialup.fu-berlin.de>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com> <uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com> <uohonn$3sm2o$2@dont-email.me> <86y1cjqpei.fsf@williamsburg.bawden.org> <lookup-20240121111504@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de /Px5drjclE4e0dJSrQRBmgQGEEwfZ8LZvaloDyoOHCJfHi
Cancel-Lock: sha1:T33iu0UqXjjVESd/Ut3Vv+z76UE= sha256:82EQeK8XDa8ThnrNsEG6i74+1+iOmdzJL3YCpBlS9fg=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Sun, 21 Jan 2024 11:46 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>Alan Bawden <alan@csail.mit.edu> writes:
>>Why didn't that work?
>Implicit invocations of special methods are only guaranteed
>to work correctly if defined on an object's type, not in
>the object's instance dictionary. (See: The Python Language
>Reference, Release 3.13.0a0; 3.3.12 Special method lookup).

That was a rhetorical question!

To use "prototypes", you need to write a custom clone method anyway
(I just posted one to "comp.lang.python"). So, while you're at it,
you can then as well define your custom global "len" function:

def len( x ): return x.__len__()

. (It might still be some work to get the rest of the
standard library to use this definition, but now we are
talking about a library and not about a language. Yes,
the Python standard library assumes class-based objects.)

Re: Is Lexical Binding The Norm Yet?

<binding-20240121183433@ram.dialup.fu-berlin.de>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17914&group=comp.lang.lisp#17914

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: 21 Jan 2024 17:35:34 GMT
Organization: Stefan Ram
Lines: 42
Expires: 1 Dec 2024 11:59:58 GMT
Message-ID: <binding-20240121183433@ram.dialup.fu-berlin.de>
References: <uo1i8c$jbru$2@dont-email.me> <86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me> <jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org> <uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com> <uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com> <uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com> <uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com> <uohonn$3sm2o$2@dont-email.me> <86y1cjqpei.fsf@williamsburg.bawden.org> <lookup-20240121111504@ram.dialup.fu-berlin.de> <len-20240121124048@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de EEZCq/LWvobtE/N49QBU8Q44xvFqqVlSPQ3yJUEAACIPcd
Cancel-Lock: sha1:h6T6HUKrjmlU0MrXZjdgGEN6KKU= sha256:8rSihSKtYTIQOpeLu/JAD3M2RjVR/0o8rmylbFgVQwo=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Sun, 21 Jan 2024 17:35 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>the Python standard library assumes class-based objects.)

Since the thread is about "binding": Python can be very
explicit when it comes to binding (should you need it).

main.py

import types

x = 2

def f():
return x

# prints "2"
print( f() )

g = types.FunctionType( f.__code__, { 'x': 4 } )

# prints "4"
print( g() )

h = types.FunctionType( f.__code__, globals() )

# prints "2"
print( h() )

def a():
x = 3

# prints "2"
print( f() )

# prints "3"
print( types.FunctionType( f.__code__, locals() )() )

# prints "2"
print( types.FunctionType( f.__code__, globals() )() )

a()

Re: Is Lexical Binding The Norm Yet?

<86ttn6qtb5.fsf@williamsburg.bawden.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17915&group=comp.lang.lisp#17915

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!news.bbs.nz!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!bawden.eternal-september.org!.POSTED!not-for-mail
From: alan@csail.mit.edu (Alan Bawden)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 16:18:22 -0500
Organization: ITS Preservation Society
Lines: 84
Message-ID: <86ttn6qtb5.fsf@williamsburg.bawden.org>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org>
<871qajgr9k.fsf@nightsong.com> <uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me>
<qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me>
<oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me>
<e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
<uohonn$3sm2o$2@dont-email.me>
<86y1cjqpei.fsf@williamsburg.bawden.org>
<lookup-20240121111504@ram.dialup.fu-berlin.de>
<len-20240121124048@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: bawden.eternal-september.org; posting-host="ddef6e23bd7d59c42d69d72840f409cd";
logging-data="406449"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19aKlEv2jbO0Z4LtMEThXp2"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
Cancel-Lock: sha1:mpP8oRh+DZfvluh/ZuQmkZZveJs=
sha1:NB8BY5z6G8UNtNkBASSk+rMbH9U=
 by: Alan Bawden - Sun, 21 Jan 2024 21:18 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>Alan Bawden <alan@csail.mit.edu> writes:
>>Why didn't that work?
>Implicit invocations of special methods are only guaranteed
>to work correctly if defined on an object's type, not in
>the object's instance dictionary. (See: The Python Language
>Reference, Release 3.13.0a0; 3.3.12 Special method lookup).

That was a rhetorical question!

I'm glad you recognized that. Yes, I was well aware of that quote from
the Python documentation. The real question I was asking is _why_ did
the Python implementors make that choice. It's because they weren't
trying to implement a prototype-based language!

To use "prototypes", you need to write a custom clone method anyway
(I just posted one to "comp.lang.python"). So, while you're at it,
you can then as well define your custom global "len" function:

def len( x ): return x.__len__()

. (It might still be some work to get the rest of the
standard library to use this definition, but now we are
talking about a library and not about a language. Yes,
the Python standard library assumes class-based objects.)

And you have to also define:

def add(x, y): return x.__add__(y)

And convince everybody to stop using infix notation. Or you have to
start with a base class like:

class PrototypeObject(object):
def __add__(self, x):
return self.add(x)
def __radd__(self, x):
return self.radd(x)
# As well as definitions for __sub__, __rsub__, __mul__, __rmul__,
# etc.

And convince everybody to use this class instead of the built-in
`object' class -- so that behavior modifications can be made by doing
`x.add = ...' etc.

Yes, you can do that. In fact, it works out pretty well if you really
need to do prototype-based programming for some reason. You can do
something similar in Common Lisp.

But that doesn't mean that Common Lisp and Python _are_ prototype-based
systems. Both are class-based and were engineered that way from the
very beginning. They both allow you to _emulate_ prototype-based
object-orientation, but is not the natural way to do things in either
language.

We started down this rat hole becase of the following exchange:

From: Lawrence D'Oliveiro <ldo@nz.invalid>
Date: Fri, 19 Jan 2024 05:42:33 -0000 (UTC)

On Thu, 18 Jan 2024 23:39:26 -0500, George Neuner wrote:

> Programming with closures is more like using "prototype OO". Prototype
> systems don't have classes, but rather ANY object can be modified to
> change its set of instance data and/or methods, and can be cloned to
> create new objects of that same "type".

That’s true of Python, too.

Lawrence's brief statement can be read as saying: "By that definition,
Python is prototype-based." That is how I read it initially, but I
think it's pretty clear that Python is not prototype-based, but
class-based.

But you can also read it as making the weaker claim: "Python can easily
support prototype-based programming." Which is true, as we've
demonstrated above, but perhaps not as interesting a claim, since it is
also true of some other class-based programming languages.

In any case, I think we've beaten this thread to death now.

- Alan

Re: Is Lexical Binding The Norm Yet?

<uok2jh$cgf7$4@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=17916&group=comp.lang.lisp#17916

  copy link   Newsgroups: comp.lang.lisp
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.lang.lisp
Subject: Re: Is Lexical Binding The Norm Yet?
Date: Sun, 21 Jan 2024 21:33:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Message-ID: <uok2jh$cgf7$4@dont-email.me>
References: <uo1i8c$jbru$2@dont-email.me>
<86r0ijsdyj.fsf@williamsburg.bawden.org> <871qajgr9k.fsf@nightsong.com>
<uo4id7$14ifr$1@dont-email.me>
<jwvedeg510z.fsf-monnier+comp.lang.lisp@gnu.org>
<uo9cbb$264u2$1@dont-email.me> <20240117122629.806@kylheku.com>
<uo9o4k$281t4$1@dont-email.me> <qitjqi521brjnpvebd2b1bidrhevocbt62@4ax.com>
<uod249$30h1g$3@dont-email.me> <oc8lqilj3c2sromuq36mp3vuee9uven9mo@4ax.com>
<uoeme2$39ohi$4@dont-email.me> <e5eoqi1116aosn2sb2oam0b8jdqv9mg0tb@4ax.com>
<uohonn$3sm2o$2@dont-email.me> <86y1cjqpei.fsf@williamsburg.bawden.org>
<lookup-20240121111504@ram.dialup.fu-berlin.de>
<len-20240121124048@ram.dialup.fu-berlin.de>
<86ttn6qtb5.fsf@williamsburg.bawden.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 Jan 2024 21:33:37 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="942a1f970482f2e4dbf1b31185d2ff4b";
logging-data="410087"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18zblMv/6dRZeIQda6FfIp9"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:YOpK3aJhm+hYzqVjhaM2WKMARtA=
 by: Lawrence D'Oliv - Sun, 21 Jan 2024 21:33 UTC

On Sun, 21 Jan 2024 16:18:22 -0500, Alan Bawden wrote:

> ... but I think it's pretty clear that Python is not prototype-based,
> but class-based.

Or maybe Python doesn’t easily fit into these neat pigeon holes you have
for conventional categories of “object-oriented” programming languages.
See the descriptor concept
<https://docs.python.org/3/reference/datamodel.html#descriptors>
for an illustration of what I mean.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor