all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Lions & tigers & variables - Oh my!   [was: Lisp error on function :documentation]
@ 2022-10-18 15:37 Drew Adams
  2022-10-18 23:25 ` Emanuel Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Drew Adams @ 2022-10-18 15:37 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs@gnu.org

> global variables can be virtually eliminated by using closures

_*ALL*_ variables can (really, not virtually) be
eliminated, with combinatory logic.  Magic.

That doesn't mean you'll likely find it preferable
to do all your programming without variables.  It
does mean that variables aren't at all necessary.

Variables are human bookkeeping labels/tags, to
help our feeble memories cope.  Useful sometimes,
a huge PITA other times - think assembler, C, etc.,
where pretty much every bit of program requires a
variable.

__


Yes, all of that is OT.  What's not OT is that for
Emacs users, _in particular_, special (global) vars
can be quite useful.

Precisely _because_ they can let you reach across
existing code without modifying it, as far as you
like, and change behavior.  And still have some
control over extent etc.  Dynamic binding is yet
another story of power being usable for good & bad.
Be careful how you use it; know why you use it.

RMS summarized the use cases 42 years ago - still
100% relevant today:

https://www.gnu.org/software/emacs/emacs-paper.html#SEC15


___

SKI etc.:

https://en.wikipedia.org/wiki/Combinatory_logic

42:

https://en.wikipedia.org/wiki/The_Hitchhiker%27s_Guide_to_the_Galaxy#42,_or_The_Answer_to_the_Ultimate_Question_of_Life,_The_Universe,_and_Everything

https://en.wikipedia.org/wiki/Jackie_Robinson




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-18 15:37 Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation] Drew Adams
@ 2022-10-18 23:25 ` Emanuel Berg
  2022-10-19 14:09   ` [External] : " Drew Adams
  2022-10-19  5:16 ` Emanuel Berg
  2022-10-19  5:27 ` Emanuel Berg
  2 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2022-10-18 23:25 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>> global variables can be virtually eliminated by using
>> closures
>
> _*ALL*_ variables can (really, not virtually) be eliminated,
> with combinatory logic. Magic.

But not in practise writing code ...

> That doesn't mean you'll likely find it preferable to do all
> your programming without variables. It does mean that
> variables aren't at all necessary.

Right.

> Yes, all of that is OT.  What's not OT is that for
> Emacs users, _in particular_, special (global) vars
> can be quite useful.

All global variables are dynamic/special but not all
dynamic/special variables are global ...

> https://www.gnu.org/software/emacs/emacs-paper.html#SEC15

Good paper ...

  Lisp is Loose!

  The traditional attitude towards Lisp holds that it is
  useful only for esoteric amusements and Artificial
  Intelligence. The appearance of Multics EMACS as a Honeywell
  product is the death knell of this view. Now, a mainframe
  manufacturer is offering a system utility program written in
  Lisp; a program intended for heavy use by the general user
  community. The special properties of Lisp, which make
  extensibility possible, are a key feature, even though many
  of the users will not be programmers. Lisp has escaped from
  the ivory tower forever, and is a force to be reckoned with
  as a system programming language.

I don't know, maybe the ivory tower has just changed form :)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-18 15:37 Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation] Drew Adams
  2022-10-18 23:25 ` Emanuel Berg
@ 2022-10-19  5:16 ` Emanuel Berg
  2022-10-19  5:27 ` Emanuel Berg
  2 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2022-10-19  5:16 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

> Yes, all of that is OT. What's not OT is that for Emacs
> users, _in particular_, special (global) vars can be
> quite useful.
>
> Precisely _because_ they can let you reach across existing
> code without modifying it [...]

But then that existing code has to use that variable. So for
the dynamic/special _and_ global variables to be useful, they
have to actually be used ;)

Let's take it from another side, I just asked what you can do
with lexical/static variables in `let'-closures, and answered
you can share them between two or several `defun', and you can
use them to keep persistent/state data between calls
to functions.

I don't know if that's a good answer in the sense that it is
complete but I know it is a good answer in the sense that it
is true because I have used let-closures exactly like that.

So we know they can do that, and global variables obviously
also can, but can global variables do something else that
they cannot?

That they can be accessed from anywhere?

So when you want that, that's when you should use them? Okay,
but then when typically do you want that? When what they
describe is so general it is just so likely that a lot of
stuff, including future stuff, will use them, so it is just
impractical to put them in a closure?

Actually in a way the whole global closure is just one big
closure for global variables I guess. It's the top-level
closure since there is nothing outside of it ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-18 15:37 Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation] Drew Adams
  2022-10-18 23:25 ` Emanuel Berg
  2022-10-19  5:16 ` Emanuel Berg
@ 2022-10-19  5:27 ` Emanuel Berg
  2 siblings, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2022-10-19  5:27 UTC (permalink / raw)
  To: help-gnu-emacs

I wrote in another post that all global variables are
dynamic/special but not all dynamic/special variables are
global, however this is incorrect, it only happens with
`defvar', not `setq' ...

(setq some-var-1 111)

(defvar some-var-2 222)

(special-variable-p 'some-var-1) ; nil

(special-variable-p 'some-var-2) ; t

(defun test-global-vars ()
  (list some-var-1 some-var-2) )

(let ((some-var-1 111000)
      (some-var-2 222000) )
  (test-global-vars) ) ; 111 222000

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [External] : Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-18 23:25 ` Emanuel Berg
@ 2022-10-19 14:09   ` Drew Adams
  2022-10-19 20:20     ` Emanuel Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Drew Adams @ 2022-10-19 14:09 UTC (permalink / raw)
  To: Emanuel Berg, help-gnu-emacs@gnu.org

> > _*ALL*_ variables can (really, not virtually) be eliminated,
> > with combinatory logic. Magic.
> 
> But not in practise writing code ...

https://en.wikipedia.org/wiki/Function-level_programming

https://www.cs.ucf.edu/~dcm/Teaching/COT4810-Fall%202012/Literature/Backus.pdf




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] : Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-19 14:09   ` [External] : " Drew Adams
@ 2022-10-19 20:20     ` Emanuel Berg
  2022-10-20  8:48       ` tomas
  0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2022-10-19 20:20 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams wrote:

>>> _*ALL*_ variables can (really, not virtually) be
>>> eliminated, with combinatory logic. Magic.
>> 
>> But not in practise writing code ...
>
> https://en.wikipedia.org/wiki/Function-level_programming

Okay, so what's the most impressive and useful program ever
written without the use of a single variable?

> https://www.cs.ucf.edu/~dcm/Teaching/COT4810-Fall%202012/Literature/Backus.pdf

Thanks, we should collect all such links on the wiki if
someone cares to mail the material to the maintainer(s) ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] : Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-19 20:20     ` Emanuel Berg
@ 2022-10-20  8:48       ` tomas
  2022-10-21  3:37         ` Emanuel Berg
  2022-10-21  8:40         ` Emanuel Berg
  0 siblings, 2 replies; 9+ messages in thread
From: tomas @ 2022-10-20  8:48 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 280 bytes --]

On Wed, Oct 19, 2022 at 10:20:22PM +0200, Emanuel Berg wrote:

[...]

> Okay, so what's the most impressive and useful program ever
> written without the use of a single variable?

Enjoy:

  https://en.wikipedia.org/wiki/Combinatory_logic#Applications

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] : Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-20  8:48       ` tomas
@ 2022-10-21  3:37         ` Emanuel Berg
  2022-10-21  8:40         ` Emanuel Berg
  1 sibling, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2022-10-21  3:37 UTC (permalink / raw)
  To: help-gnu-emacs

tomas wrote:

>> Okay, so what's the most impressive and useful program ever
>> written without the use of a single variable?
>
> Enjoy:
>
>   https://en.wikipedia.org/wiki/Combinatory_logic#Applications

SASL?

I just got the source from the Debian repos for GNU SASL, it
is written in C and in imap.c line 26 is

  char *in;

I suppose that is the one of very few variables used tho ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [External] : Re: Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation]
  2022-10-20  8:48       ` tomas
  2022-10-21  3:37         ` Emanuel Berg
@ 2022-10-21  8:40         ` Emanuel Berg
  1 sibling, 0 replies; 9+ messages in thread
From: Emanuel Berg @ 2022-10-21  8:40 UTC (permalink / raw)
  To: help-gnu-emacs

GNU SASL, as I will mention in a post that hasn't appeared
here (yet), has nothing to do with it, since that is this

  SASL 1997 Simple Authentication and Security Layer, in protocols

and not this, which I think is what Tomás refered to

  SASL 1972 St Andrews Static Language. functional, no variables [1]

That said, what I meant was, has there been any Quake, mpv,
Emacs, xterm etc ever written without the use of variables?
Here [2] is what I use. It's pretty broad. Is there anything
I can replace with such software?

Because until I see it, I don't believe it. In this case!

[1] https://dataswamp.org/~incal/COMP-HIST
[2] https://dataswamp.org/~incal/SOFTWARE

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-10-21  8:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-18 15:37 Lions & tigers & variables - Oh my! [was: Lisp error on function :documentation] Drew Adams
2022-10-18 23:25 ` Emanuel Berg
2022-10-19 14:09   ` [External] : " Drew Adams
2022-10-19 20:20     ` Emanuel Berg
2022-10-20  8:48       ` tomas
2022-10-21  3:37         ` Emanuel Berg
2022-10-21  8:40         ` Emanuel Berg
2022-10-19  5:16 ` Emanuel Berg
2022-10-19  5:27 ` Emanuel Berg

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.