• Command Languages Versus Programming Languages

    From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 01:14:18 2024
    From Newsgroup: comp.lang.misc

    At one time, we distinguished between “scripting” languages and “programming” languages. To begin with, the “scripting” languages were somehow more limited in functionality than full-fledged “programming” languages. Or they were slower, because they were interpreted.

    Then languages like Perl and Java came along: both were compiled to a
    bytecode, a sort of pseudo-machine-language, which was interpreted by
    software, not CPU hardware. Were they “scripting” or “programming” languages? Some might have classed Perl as a “scripting” language to
    begin with, but given it is must as powerful as Java, then why
    shouldn’t Java also be considered a “scripting” rather than “programming” language? And before these two, there was UCSD Pascal,
    which was probably the pioneer of this compile-to-bytecode idea.

    So that terminology for distinguishing between classes of programming
    languages became largely obsolete.

    But there is one distinction that I think is still relevant, and that
    is the one between shell/command languages and programming languages.

    In a shell language, everything you type is assumed to be a literal
    string, unless you use special substitution sequences. E.g. in a POSIX
    shell:

    ls -l thingy

    “give me information about the file/directory named ‘thingy’”, vs.

    ls -l $thingy

    “give me information about the files/directories whose names are in
    the value of the variable ‘thingy’”.

    Whereas in a programming language, everything is assumed to be a
    language construct, and every unadorned name is assumed to reference
    some value/object, so you need quote marks to demarcate literal
    strings, e.g. in Python:

    os.listdir(thingy)

    “return a list of the contents of the directory whose name is in the
    variable ‘thingy’”, vs.

    os.listdir("thingy")

    “return a list of the contents of the directory named ‘thingy’”.

    This difference in design has to do with their typical usage: most of
    the use of a shell/command language is in typing a single command at a
    time, for immediate execution. Whereas a programming language is
    typically used to construct sequences consisting of multiple lines of
    code before they are executed.

    This difference is also why attempts to use programming languages as
    though they were shell/command languages, entering and executing a
    single line of code at a time, tend to end up being more trouble than
    they are worth.

    Conversely, using shell/command languages as programming languages, by collecting multiple lines of code into shell scripts, does work, but
    only up to a point. The concept of variable substitution via string substitution tends to lead to trouble when trying to do more advanced
    data manipulations.

    So, in short, while there is some overlap in their applicable usage
    areas, they are still very much oriented to different application
    scenarios.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From candycanearter07@candycanearter07@candycanearter07.nomail.afraid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 03:10:12 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> wrote at 01:14 this Friday (GMT):
    At one time, we distinguished between “scripting” languages and “programming” languages. To begin with, the “scripting” languages were
    somehow more limited in functionality than full-fledged “programming” languages. Or they were slower, because they were interpreted.

    Then languages like Perl and Java came along: both were compiled to a bytecode, a sort of pseudo-machine-language, which was interpreted by software, not CPU hardware. Were they “scripting” or “programming” languages? Some might have classed Perl as a “scripting” language to begin with, but given it is must as powerful as Java, then why
    shouldn’t Java also be considered a “scripting” rather than “programming” language? And before these two, there was UCSD Pascal, which was probably the pioneer of this compile-to-bytecode idea.

    So that terminology for distinguishing between classes of programming languages became largely obsolete.

    But there is one distinction that I think is still relevant, and that
    is the one between shell/command languages and programming languages.

    In a shell language, everything you type is assumed to be a literal
    string, unless you use special substitution sequences. E.g. in a POSIX
    shell:

    ls -l thingy

    “give me information about the file/directory named ‘thingy’”, vs.

    ls -l $thingy

    “give me information about the files/directories whose names are in
    the value of the variable ‘thingy’”.

    Whereas in a programming language, everything is assumed to be a
    language construct, and every unadorned name is assumed to reference
    some value/object, so you need quote marks to demarcate literal
    strings, e.g. in Python:

    os.listdir(thingy)

    “return a list of the contents of the directory whose name is in the variable ‘thingy’”, vs.

    os.listdir("thingy")

    “return a list of the contents of the directory named ‘thingy’”.

    This difference in design has to do with their typical usage: most of
    the use of a shell/command language is in typing a single command at a
    time, for immediate execution. Whereas a programming language is
    typically used to construct sequences consisting of multiple lines of
    code before they are executed.

    This difference is also why attempts to use programming languages as
    though they were shell/command languages, entering and executing a
    single line of code at a time, tend to end up being more trouble than
    they are worth.

    Conversely, using shell/command languages as programming languages, by collecting multiple lines of code into shell scripts, does work, but
    only up to a point. The concept of variable substitution via string substitution tends to lead to trouble when trying to do more advanced
    data manipulations.

    So, in short, while there is some overlap in their applicable usage
    areas, they are still very much oriented to different application
    scenarios.


    Interesting, I never thought of it like that.
    --
    user <candycane> is generated from /dev/urandom
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 09:55:33 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 01:14:18 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    At one time, we distinguished between “scripting” languages and >“programming” languages. To begin with, the “scripting” languages were >somehow more limited in functionality than full-fledged “programming” >languages. Or they were slower, because they were interpreted.

    Then languages like Perl and Java came along: both were compiled to a >bytecode, a sort of pseudo-machine-language, which was interpreted by >software, not CPU hardware. Were they “scripting” or “programming” >languages? Some might have classed Perl as a “scripting” language to

    My rule of thimb is that a scripting language is one whereby the source code can be run immediately by the interpreter, eg perl, python, regardless of
    what happens internally. A full fledged programming language is one that requires a compile/debug/link step first with the compiler and runtime (if required) being seperate. eg Java, C


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 08:09:46 2024
    From Newsgroup: comp.lang.misc

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

    At one time, we distinguished between “scripting” languages and “programming” languages. [...] But there is one distinction that I
    think is still relevant, and that is the one between shell/command
    languages and programming languages.

    [...]

    Consider looking at a shell language like a domain-specific programming language. A shell is a programming language made specifically for
    running programs. When you write a shell line, you're specifying the
    arguments of execve(2). In other words, a shell is a programming
    language made to prepare the memory to be consumed by the system in a
    specific way---execve(2). (Of course, the idea evolves and you want to
    glue programs, do variable substitution et cetera.)

    A scripting language is a programming language made for a hypothetical
    machine, not too different from a programming language made for a real
    machine, one made of hardware.

    You seem to find trouble with using a programming language in a REPL.
    It seems to contradict be the overall feeling of so many people who
    understand a lot about programming---who made all of these things
    actually work (and fun).
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From =?UTF-8?Q?Josef_M=C3=B6llers?=@josef@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 12:10:20 2024
    From Newsgroup: comp.lang.misc

    On 29.03.24 10:55, Muttley@dastardlyhq.com wrote:
    On Fri, 29 Mar 2024 01:14:18 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    At one time, we distinguished between “scripting” languages and
    “programming” languages. To begin with, the “scripting” languages were
    somehow more limited in functionality than full-fledged “programming”
    languages. Or they were slower, because they were interpreted.

    Then languages like Perl and Java came along: both were compiled to a
    bytecode, a sort of pseudo-machine-language, which was interpreted by
    software, not CPU hardware. Were they “scripting” or “programming” >> languages? Some might have classed Perl as a “scripting” language to

    My rule of thimb is that a scripting language is one whereby the source code can be run immediately by the interpreter, eg perl, python, regardless of what happens internally. A full fledged programming language is one that requires a compile/debug/link step first with the compiler and runtime (if required) being seperate. eg Java, C

    I second that.

    My 2€cts,
    Josef

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Richard Kettlewell@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 11:40:03 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:
    My rule of thimb is that a scripting language is one whereby the source code can be run immediately by the interpreter, eg perl, python, regardless of what happens internally. A full fledged programming language is one that requires a compile/debug/link step first with the compiler and runtime (if required) being seperate. eg Java, C

    C can be a scripting language by that rule:

    $ cat t.c
    #!/usr/bin/tcc -run
    #include <stdio.h>

    int main(void) {
    return printf("Hello, world\n");
    }
    $ ./t.c
    Hello, world
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 12:02:34 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 11:40:03 +0000
    Richard Kettlewell <invalid@invalid.invalid> wrote:
    Muttley@dastardlyhq.com writes:
    My rule of thimb is that a scripting language is one whereby the source code >> can be run immediately by the interpreter, eg perl, python, regardless of
    what happens internally. A full fledged programming language is one that
    requires a compile/debug/link step first with the compiler and runtime (if >> required) being seperate. eg Java, C

    C can be a scripting language by that rule:

    No definition is perfect in this case, its all shades of grey.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 13:47:07 2024
    From Newsgroup: comp.lang.misc

    On 29/03/2024 02:14, Lawrence D'Oliveiro wrote:
    At one time, we distinguished between “scripting” languages and “programming” languages. To begin with, the “scripting” languages were
    somehow more limited in functionality than full-fledged “programming” languages. Or they were slower, because they were interpreted.

    I don't think there has ever been a clear distinction.

    A "script" is usually small and often written for a particular task on a particular system, while a "program" might be bigger and more generic, runnable on multiple systems by multiple people. But there is no
    dividing point in the type of code, and plenty of overlap - even though
    the difference is often clear ("This is a script for making backups of
    my servers - it uses the rsync program to do the bulk of the work").

    Similarly, there are not "scripting languages" and "programming
    languages". There are languages that are more suitable for script work,
    and languages that are more suitable for programming work, and languages
    that are suitable for both.

    Then there are "interpreted" languages and "compiled" languages. As you
    say, this is not a binary distinction - there are shades between this, especially with byte compiling. Some languages, such as Python, are
    used like interpreted language (you "run" the source code) but are byte-compiled on the fly. Some, like Java, are used like compiled
    languages but generate byte code that is interpreted. Others use some byte-compiled code along with JIT machine code to blur the lines even more.

    It is fair to say that "scripts" are usually written in interpreted
    languages (or languages designed to look like they interpreted, by
    compiling or byte-compiling on the fly). "Programs" can be written in interpreted or compiled languages - there is no consensus.


    Then languages like Perl and Java came along: both were compiled to a bytecode, a sort of pseudo-machine-language, which was interpreted by software, not CPU hardware. Were they “scripting” or “programming” languages? Some might have classed Perl as a “scripting” language to begin with, but given it is must as powerful as Java, then why
    shouldn’t Java also be considered a “scripting” rather than “programming” language? And before these two, there was UCSD Pascal, which was probably the pioneer of this compile-to-bytecode idea.


    Such classification is just wrong, IMHO. You can write scripts in Perl,
    and you can write programs in Perl. "APL" is invariably (AFAIK)
    interpreted, and it is for programming rather than scripting - the
    acronym stands for "A Programming Language".

    And of course there are many computer languages whose prime purpose is
    other tasks, even though they can be used for programming - TeX and
    Postscript are examples.

    So that terminology for distinguishing between classes of programming languages became largely obsolete.

    I am not at all convinced it was ever relevant to distinguish between "scripting languages" and "programming languages". It was useful to distinguish between "interpreted" and "compiled" languages, and the
    overlap and blurring has increased there.


    But there is one distinction that I think is still relevant, and that
    is the one between shell/command languages and programming languages.

    In a shell language, everything you type is assumed to be a literal
    string, unless you use special substitution sequences. E.g. in a POSIX
    shell:

    ls -l thingy

    “give me information about the file/directory named ‘thingy’”, vs.

    ls -l $thingy

    “give me information about the files/directories whose names are in
    the value of the variable ‘thingy’”.

    Whereas in a programming language, everything is assumed to be a
    language construct, and every unadorned name is assumed to reference
    some value/object, so you need quote marks to demarcate literal
    strings, e.g. in Python:

    os.listdir(thingy)

    “return a list of the contents of the directory whose name is in the variable ‘thingy’”, vs.

    os.listdir("thingy")

    “return a list of the contents of the directory named ‘thingy’”.

    This difference in design has to do with their typical usage: most of
    the use of a shell/command language is in typing a single command at a
    time, for immediate execution. Whereas a programming language is
    typically used to construct sequences consisting of multiple lines of
    code before they are executed.

    That is arguably a useful distinction in the style of programming
    languages, and this difference makes the language more or less suited to particular tasks (such as typical short scripts).

    Again, however, there are exceptions that mean a clear binary
    distinction is not possible. Knuth did a lot of work on "literary programming", where documentation and source is combined along with
    executable code, and used such languages and tools for programs like TeX
    and Metafont. ("Linux from Scratch" is another example.)

    TCL is a language that might be considered half-way between your
    categories here.


    This difference is also why attempts to use programming languages as
    though they were shell/command languages, entering and executing a
    single line of code at a time, tend to end up being more trouble than
    they are worth.

    Conversely, using shell/command languages as programming languages, by collecting multiple lines of code into shell scripts, does work, but
    only up to a point. The concept of variable substitution via string substitution tends to lead to trouble when trying to do more advanced
    data manipulations.

    So, in short, while there is some overlap in their applicable usage
    areas, they are still very much oriented to different application
    scenarios.


    <https://en.wikipedia.org/wiki/List_of_programming_languages_by_type>
    gives something like 40 categories of programming languages, of which "scripting languages" is one type. I think any attempt at dividing up programming languages will either be so full of grey areas as to be
    almost useless, or have so many categories that it is almost useless.
    The best you can do is pick some characteristics of languages, or some
    typical use-cases of languages, and ask if any given language fits there.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 08:44:54 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg
    Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged
    programming languages" o_O Johanne's definition of a "scripting
    language" as a DSL designed for directing the actions of the operating
    system makes much more sense, IMHO.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 16:02:13 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg
    Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged
    programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp. Forth maybe,
    no idea.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 09:10:01 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 16:02:13 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:

    By *that* logic, even Lisp and Forth don't count as "full-fledged >programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp. Forth
    maybe, no idea.

    Well, suffice to say that Forth is bare-metal enough to serve as the
    foundation for OpenFirmware systems... ;P

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:09:56 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 11:40:03 +0000
    Richard Kettlewell <invalid@invalid.invalid> wrote:
    Muttley@dastardlyhq.com writes:
    My rule of thimb is that a scripting language is one whereby the source code
    can be run immediately by the interpreter, eg perl, python, regardless of >>> what happens internally. A full fledged programming language is one that >>> requires a compile/debug/link step first with the compiler and runtime (if >>> required) being seperate. eg Java, C

    C can be a scripting language by that rule:

    No definition is perfect in this case, its all shades of grey.

    Yes, a definition can be close to perfet here:

    Scripting is an activity, a use case, not a language.

    Scripting refers to executing commands which are so high level that they
    are entire applications or functional blocks within an application.
    Scripting automates applications or groups of applications.

    A language can /support/ scripting (and other paradigms).

    If a language only supports scripting well, and nothing else, then it's
    a scripting language. That's exactly the same as that a language can be functional, or multi-paradigm with support for functional programming.

    Scripting tend to have the attribute that they would never be used (and possibly could not be used) to write the functional building blocks
    which their commands execute. It's possible for an application to be
    written in a language in which it is scripted, but then that's almost
    certainly not a scripting language.

    Yes, an aspect of scripting is that scripts are taken as-is, in the representation in which they are written. Or at least, can be. If there
    is a compiling step, it is either optional, or hidden by the
    implementation. The requirement for some ahead-of-time compilation
    ritual to prepare the script for execution by translating it to a
    different file in a different format is anti-scripting, in a sense.

    The ordinary meaning of the word "script" refers to a dialog followed by
    an actor, in the same form in which it was written. The programming
    word was almost certainly coined in reference to that.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:12:40 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29, John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg
    Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged
    programming languages" o_O Johanne's definition of a "scripting
    language" as a DSL designed for directing the actions of the operating
    system makes much more sense, IMHO.

    Common Lisp requires the implementation to be able to read
    and execute printed expressions, without having them placed into
    a file that must be translated to a compiled file.

    The most prominent CL implementations compile every form before
    executing it, even at the interactive prompt. It's invisible to the
    user.

    Scripting doesn't mean that the commands cannot be transparently
    translated into antoher language before being executed.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:13:47 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg
    Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged >>programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp.

    The Lisp machines had operating systems and device drivers written in
    Lisp, interrupt-driven and all. Where do you perceive the difficulty?
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:18:23 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 17:09:56 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 11:40:03 +0000
    Richard Kettlewell <invalid@invalid.invalid> wrote: >>>Muttley@dastardlyhq.com writes:
    My rule of thimb is that a scripting language is one whereby the source >code
    can be run immediately by the interpreter, eg perl, python, regardless of >>>> what happens internally. A full fledged programming language is one that >>>> requires a compile/debug/link step first with the compiler and runtime (if

    required) being seperate. eg Java, C

    C can be a scripting language by that rule:

    No definition is perfect in this case, its all shades of grey.

    Yes, a definition can be close to perfet here:

    Define perfect. Yours isn't.

    Scripting is an activity, a use case, not a language.

    So if I write a program to for example process some files in a directory by your argument its a script whether I write it in shell, python, C++ or assembler.

    Umm, no, try again.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:20:49 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 17:13:47 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg
    Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged >>>programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp.

    The Lisp machines had operating systems and device drivers written in
    Lisp, interrupt-driven and all. Where do you perceive the difficulty?

    Were the mucky bits actually written in Lisp or was Lisp simply calling some routines written in assembler? In the same sense that Python doesn't actually "do" AI, its way too slow, the AI but is done in libraries written in C++ that Python simply calls.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:25:18 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 17:09:56 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 11:40:03 +0000
    Richard Kettlewell <invalid@invalid.invalid> wrote: >>>>Muttley@dastardlyhq.com writes:
    My rule of thimb is that a scripting language is one whereby the source >>code
    can be run immediately by the interpreter, eg perl, python, regardless of >>>>> what happens internally. A full fledged programming language is one that >>>>> requires a compile/debug/link step first with the compiler and runtime (if

    required) being seperate. eg Java, C

    C can be a scripting language by that rule:

    No definition is perfect in this case, its all shades of grey.

    Yes, a definition can be close to perfet here:

    Define perfect. Yours isn't.

    Scripting is an activity, a use case, not a language.

    So if I write a program to for example process some files in a directory by your argument its a script whether I write it in shell, python, C++ or assembler.

    I also wrote: "Scripting refers to executing commands which are so high
    level that they are entire applications or functional blocks within an application."

    If you write the program in assembler, are the instructions
    "commands which are so high level that they are entire applications
    or functional blocks within an application?"

    In the assembly language program, mulitiple instructions, irrelevant
    to the file processing task, are required just to correctly set up a
    function call with parameters and return from it.

    You're just being deliberately obtuse, not to mention snippy with the
    scissors.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:58:41 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 17:13:47 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg >>>>> Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged >>>>programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp.

    The Lisp machines had operating systems and device drivers written in
    Lisp, interrupt-driven and all. Where do you perceive the difficulty?

    Were the mucky bits actually written in Lisp or was Lisp simply calling some routines written in assembler?

    Sorry, could you demarcate where exactly the goalposts are? Which mucky
    bits?

    In kernels written in C, there are mucky bits in assembler, like
    entry and exit into an trap/interrupt handler. You usually can't save
    the machine state in an interrupt handler without some instruction that
    is of no use in general code generation, not to mention detailed access
    to all the working registers that are not normally manipulated from the
    HLL.

    Yes, the mucky bits of communicating with the device, like passing
    frames to and from an ethernet card, would be written in Lisp.

    Assembly routines in Lisps, though not Lisp, can at least be written
    in Lisp notation and assembled within Lisp.

    In machine-compiled Lisps, there is the possibility of inline code,
    like in C or other languages.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Christian Weisgerber@naddy@mips.inka.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 18:12:35 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:

    As a counter point, good luck writing a device driver in lisp.

    Mmh--anybody know whether that was done for Lisp machines?
    --
    Christian "naddy" Weisgerber naddy@mips.inka.de
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David W. Hodgins@dwhodgins@nomail.afraid.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 14:51:07 2024
    From Newsgroup: comp.lang.misc

    The distinctions between script and programming languages made sense when
    they were first introduced. Later, the ability to compile scripts followed
    by the things like java bytecode, and then the use of microcode in to make "machine language" act like a script have made the distinction murky to
    the point of effectively being useless at the technical level.

    From the user's point of view, text files the are executed by passing them
    to an interpreter are best called scripts, and anything that goes through
    some sort of compilation to a binary file that then gets executed are best called programs.

    The terminology will continue to be used, but the distinction does not matter, except from a speed of processing difference.

    Regards, Dave Hodgins
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 16:38:48 2024
    From Newsgroup: comp.lang.misc

    "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

    [...]

    The terminology will continue to be used, but the distinction does not matter, except from a speed of processing difference.

    Just to share that I, personally, don't use the distinction. For
    instance, I say that

    "the answer is %.2f\n"

    is a program that builds a string given its usual context. I say that

    awk '1; { print "" }'

    is a program to double-space a file. I haven't said ``script'' in
    years.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 20:07:29 2024
    From Newsgroup: comp.lang.misc

    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    A scripting language is a programming language made for a hypothetical >machine, not too different from a programming language made for a real >machine, one made of hardware.

    C is clearly a programming language, yet its specification
    says, "The semantic descriptions in this document describe
    the behavior of an abstract machine". And you cannot buy
    this abstract C machine as a piece of hardware anywhere!
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 20:36:52 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 13:47:07 +0100, David Brown wrote:

    TCL is a language that might be considered half-way between your
    categories here.

    TCL is definitely an interesting in-between case. In my limited use, I
    recall it was awkward with data structures, just like shell languages. So maybe that puts it more on the shell side than the programming side.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 20:59:02 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 10:37:22 +0100, Janis Papanagnou wrote:

    Program text is initially text.[*] During parsing (either in
    an interpreted or in a compiled language) you split the text
    in tokens.

    And then, how do you interpret the tokens? In a shell language, you have
    the assumption that “everything is literal text until indicated otherwise”; in a programming language, you have the assumption that “everything is a program construct until indicated otherwise”.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 21:06:58 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 08:09:46 -0300, Johanne Fairchild wrote:

    Consider looking at a shell language like a domain-specific programming language. A shell is a programming language made specifically for
    running programs. ... (Of course, the idea evolves and you want to
    glue programs, do variable substitution et cetera.)

    That’s the thing. The design for a “language made specifically for running programs” always seems to start with the assumption that what the user
    types is to be passed as literal text, unless special markers are present
    to indicate that they want to “glue programs, do variable substitution et cetera”. Notice your use of the term “variable substitution”, which is characteristic of a shell language: in a programming language, you don’t call it “substitution”, you call it “evaluation”.

    A scripting language is a programming language made for a hypothetical machine, not too different from a programming language made for a real machine, one made of hardware.

    In our CS classes we learned to think about “abstract machines”, and forget the distinction between “software” and “hardware”. Instead, we build layers of abstract machines, one on top of the other, getting more
    and more specialized towards the particular class of problems we want to
    solve at any particular time.

    Command languages are just another such “abstract machine”, and the scripts we write in them are another layer on top.

    The layering only stops when you get to a GUI; they can’t be used to build any further “machines” on top.

    You seem to find trouble with using a programming language in a REPL.

    I find REPLs annoying and inconvenient. If I want to do “scratchpad” programming, I do it in a Jupyter notebook.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 00:14:42 2024
    From Newsgroup: comp.lang.misc

    On 29.03.2024 21:59, Lawrence D'Oliveiro wrote:
    On Fri, 29 Mar 2024 10:37:22 +0100, Janis Papanagnou wrote:

    Program text is initially text.[*] During parsing (either in
    an interpreted or in a compiled language) you split the text
    in tokens.

    And then, how do you interpret the tokens?

    In an interpreter the tokens are interpreted, in a compiler
    they are subject to the parsing. (But you know that I'm sure.)

    What I was saying is that there's initially literal program text
    that is transformed to tokens in the lexical analysis, and then
    further processed.

    It was a reply on your original statement which was:
    In a shell language, everything you type is assumed to be a
    literal string, unless you use special substitution sequences.

    In a shell language, you have
    the assumption that “everything is literal text until indicated otherwise”;

    Who is that "you"? (Not me, for sure.) And where did you get that
    from?

    in a programming language, you have the assumption that
    “everything is a program construct until indicated otherwise”.

    So what is 'for i in a ; do ... ; done' then in your world?

    This is one of many basic shell constructs that I use in shell
    programming (not "shell scripting") regularly.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 00:14:48 2024
    From Newsgroup: comp.lang.misc

    On 29.03.2024 19:51, David W. Hodgins wrote:
    The distinctions between script and programming languages made sense when they were first introduced. [...]

    I abandoned the term "shell script" as soon as I got aware that
    writing a reliable piece of software with "scripts" follows the
    same engineering techniques and requires the same quality means
    as non-"scripts". (Occasionally I still use the term informally
    though I don't see any formal, technical, or practical necessity
    for any such distinction between Command and Programming Language
    as far as _programming_ is concerned.)

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 00:45:21 2024
    From Newsgroup: comp.lang.misc

    On 30.03.2024 00:14, Janis Papanagnou wrote:
    On 29.03.2024 21:59, Lawrence D'Oliveiro wrote:
    On Fri, 29 Mar 2024 10:37:22 +0100, Janis Papanagnou wrote:

    Program text is initially text.[*] During parsing (either in
    an interpreted or in a compiled language) you split the text
    in tokens.

    And then, how do you interpret the tokens?

    In an interpreter the tokens are interpreted, in a compiler
    they are subject to the parsing. [...]

    Just noticed that this may be misleading. Of course the shell
    does also a syntax analysis step and report syntax errors. So
    don't get me wrong here.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 23:51:02 2024
    From Newsgroup: comp.lang.misc

    On Sat, 30 Mar 2024 00:14:42 +0100, Janis Papanagnou wrote:

    What I was saying is that there's initially literal program text
    that is transformed to tokens in the lexical analysis, and then
    further processed.

    In a shell language, that is “further processed” as literal text, except for any instances of substitution markers.

    in a programming language, you have the assumption that
    “everything is a program construct until indicated otherwise”.

    So what is 'for i in a ; do ... ; done' then in your world?

    “for” is just the name of a command, like any other. In POSIX, this one happens to be built into the shell; it might not in other shells.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:01:45 2024
    From Newsgroup: comp.lang.misc

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 29.03.2024 21:59, Lawrence D'Oliveiro wrote:
    On Fri, 29 Mar 2024 10:37:22 +0100, Janis Papanagnou wrote:

    Program text is initially text.[*] During parsing (either in
    an interpreted or in a compiled language) you split the text
    in tokens.

    And then, how do you interpret the tokens?

    In an interpreter the tokens are interpreted, in a compiler
    they are subject to the parsing. (But you know that I'm sure.)

    Are you suggesting that interpreters don't parse their input? No doubt
    there are interpreters that handle tokens one at a time, but shells
    typically don't work that way.

    There are a lot of different ways to distinguish between languages like sh/ksh/bash that are normally interpreted and languages like C that are normally compiled to machine code:

    - Is the language primarily designed for interactive command-line use?
    - Is the language normally compiled to machine code?
    - Is the language compiled by some kind of byte code that is then
    interpreted? Is that byte code *sometimes* translated to machine
    code?
    - Is foo treated by default as a string or as an identifier?
    (Treating it as a string is convenient for interactive use.)
    - Does a syntax error on line 10 prevent lines 1-9 from being executed?

    I don't think *any* of these distinctions are fundamental.

    For example, a Perl or Python program/script is parsed and "compiled"
    into some in-memory form before execution begins. A syntax error
    prevents the entire script from being executed. In Bourne-line shells,
    a syntax error won't be detected until execution reaches that line.
    (Things like Perl's BEGIN and eval can complicate things.)

    Shells also have to parse their input, though it's done a bit
    differently. Typically the entire script isn't parsed as a unit.

    [...]

    So what is 'for i in a ; do ... ; done' then in your world?

    This is one of many basic shell constructs that I use in shell
    programming (not "shell scripting") regularly.

    I use it both in shell scripting/programming and interactively.

    And the entire construct needs to be processed before the shell can
    begin to execute it. Misspelling "done" prevents the whole thing from
    running.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:03:05 2024
    From Newsgroup: comp.lang.misc

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 30.03.2024 00:14, Janis Papanagnou wrote:
    On 29.03.2024 21:59, Lawrence D'Oliveiro wrote:
    On Fri, 29 Mar 2024 10:37:22 +0100, Janis Papanagnou wrote:

    Program text is initially text.[*] During parsing (either in
    an interpreted or in a compiled language) you split the text
    in tokens.

    And then, how do you interpret the tokens?

    In an interpreter the tokens are interpreted, in a compiler
    they are subject to the parsing. [...]

    Just noticed that this may be misleading. Of course the shell
    does also a syntax analysis step and report syntax errors. So
    don't get me wrong here.

    I did indeed get you wrong here (see my other followup).
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:06:35 2024
    From Newsgroup: comp.lang.misc

    On 30.03.2024 01:03, Keith Thompson wrote:

    Just noticed that this may be misleading. Of course the shell
    does also a syntax analysis step and report syntax errors. So
    don't get me wrong here.

    I did indeed get you wrong here (see my other followup).

    Sorry for the inconvenience!

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 17:08:35 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Sat, 30 Mar 2024 00:14:42 +0100, Janis Papanagnou wrote:
    What I was saying is that there's initially literal program text
    that is transformed to tokens in the lexical analysis, and then
    further processed.

    In a shell language, that is “further processed” as literal text, except for any instances of substitution markers.

    in a programming language, you have the assumption that
    “everything is a program construct until indicated otherwise”.

    So what is 'for i in a ; do ... ; done' then in your world?

    “for” is just the name of a command, like any other. In POSIX, this one happens to be built into the shell; it might not in other shells.

    "for" is not just a command. It's a keyword, part of the shell language syntax.

    By contrast, "echo" is a command that may be built into the shell or
    not, and behaves similarly either way. There's no way to implement
    "for" as an external command.

    (Very early UNIX shells had "goto" as an external command. The
    implementation was convoluted.)
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 21:17:48 2024
    From Newsgroup: comp.lang.misc

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

    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    A scripting language is a programming language made for a hypothetical >>machine, not too different from a programming language made for a real >>machine, one made of hardware.

    C is clearly a programming language, yet its specification
    says, "The semantic descriptions in this document describe
    the behavior of an abstract machine". And you cannot buy
    this abstract C machine as a piece of hardware anywhere!

    Of course. :) But we both know what that means. It's abstract because
    there are so many real machines for which this abstract one is an
    abstraction of. And the real ones are the target of the language.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 21:24:01 2024
    From Newsgroup: comp.lang.misc

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

    On Fri, 29 Mar 2024 08:09:46 -0300, Johanne Fairchild wrote:

    Consider looking at a shell language like a domain-specific programming
    language. A shell is a programming language made specifically for
    running programs. ... (Of course, the idea evolves and you want to
    glue programs, do variable substitution et cetera.)

    That’s the thing. The design for a “language made specifically for running
    programs” always seems to start with the assumption that what the user types is to be passed as literal text, unless special markers are present
    to indicate that they want to “glue programs, do variable substitution et cetera”. Notice your use of the term “variable substitution”, which is characteristic of a shell language: in a programming language, you don’t call it “substitution”, you call it “evaluation”.

    That's right. Substitution is evaluation; a specific form of.

    You seem to find trouble with using a programming language in a REPL.

    I find REPLs annoying and inconvenient. If I want to do “scratchpad” programming, I do it in a Jupyter notebook.

    That's something to think about. Your perception is wildly different
    from a lot of people who have thought and think very deeply about the
    whole craft.

    Consider your Lisp writing, which violates the culture of Lisp writing.
    Of course you should keep your independence, but maybe there are good
    reasons why the culture is as it is---not all culture is fashion.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:30:53 2024
    From Newsgroup: comp.lang.misc

    On 30.03.2024 00:51, Lawrence D'Oliveiro wrote:
    On Sat, 30 Mar 2024 00:14:42 +0100, Janis Papanagnou wrote:

    So what is 'for i in a ; do ... ; done' then in your world?

    “for” is just the name of a command, like any other. In POSIX, this one happens to be built into the shell; it might not in other shells.

    'for' is a "reserved word" and part of a "compound command". It's
    part of the _shell syntax_! - You get syntax errors like

    $ for ; do : ; done
    ksh: syntax error: `;' unexpected

    And, specifically, "i in a" are *not* arguments of a 'for' command
    but also part of the control construct syntax.

    But, okay, I see where you're coming from.

    Besides the naming, keep in mind that there's a semantical differences
    between a "command", a "built-in command", and "shell construct". An
    example where you can observe operational differences is:
    '/bin/test' and '/bin/['
    'test' and '['
    '[['
    where (for example) the latter does not need quoting.

    $ x="Hello world" ; [[ $x == "Hello world" ]] ; echo $?
    0
    $ x="Hello world" ; [ $x == "Hello world" ] ; echo $?
    ksh: [: world: unknown operator
    2
    $ x="Hello world" ; [ "$x" == "Hello world" ] ; echo $?
    0

    The distinction is important since there's operational differences
    associated with these forms. The same holds for other control constructs ("built-in compound commands"), like 'case', or even simple assignments.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:49:20 2024
    From Newsgroup: comp.lang.misc

    On 30.03.2024 01:01, Keith Thompson wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    So what is 'for i in a ; do ... ; done' then in your world?

    This is one of many basic shell constructs that I use in shell
    programming (not "shell scripting") regularly.

    I use it both in shell scripting/programming and interactively.

    So do I. (To me there's no significant difference. Only that larger
    projects I do not start to develop in interactive mode, of course.)

    And the entire construct needs to be processed before the shell can
    begin to execute it. Misspelling "done" prevents the whole thing from running.

    Indeed.

    From the other posters statements I got the impression that he may
    think that control constructs is what makes the difference (between
    scripting and programming, or, command interpreters and programming
    languages; still not sure what he thinks). In a later post I read
    it as if the naming of e.g. 'for' as a "command" leads to his view.
    Anyway.

    I can see a point where people use for interactive use other shells
    than for programming; like tcsh (interactively) and bash (programming),
    because of the powerful features tcsh supports. Since the increase of interactive features supported by the shells that are typically used
    for programming I prefer to have the same shell with same syntax and
    features for both, and to be able to pass code from one application
    context to the other.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 18:00:16 2024
    From Newsgroup: comp.lang.misc

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    [...]
    I can see a point where people use for interactive use other shells
    than for programming; like tcsh (interactively) and bash (programming), because of the powerful features tcsh supports. Since the increase of interactive features supported by the shells that are typically used
    for programming I prefer to have the same shell with same syntax and
    features for both, and to be able to pass code from one application
    context to the other.

    Indeed. I spent several years using tcsh interactively (because it had
    a few interactive features that I found convenient) and bash for writing scripts (previously I had actually written *gasp* csh and tcsh scripts). Eventually I found that using a single shell for both was easier, and
    that bash's interactive features are about as good as tcsh's. (And I
    can write complex nested commands on one line, something I probably
    wouldn't have attempted in [t]csh even if it were possible.) I haven't
    looked back.

    zsh has some nice features, but I haven't learned it well enough to
    consider switching.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:11:31 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 21:24:01 -0300, Johanne Fairchild wrote:

    Consider your Lisp writing, which violates the culture of Lisp writing.
    Of course you should keep your independence, but maybe there are good
    reasons why the culture is as it is---not all culture is fashion.

    Let me know what they are. The only reasons I have seen offered so far are basically just “that’s the way it’s always been done”.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:12:05 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 17:08:35 -0700, Keith Thompson wrote:

    "for" is not just a command. It's a keyword, part of the shell language syntax.

    Remember, that’s only true of POSIX shells.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 18:15:05 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Fri, 29 Mar 2024 17:08:35 -0700, Keith Thompson wrote:

    "for" is not just a command. It's a keyword, part of the shell language
    syntax.

    Remember, that’s only true of POSIX shells.

    It may well be true of some non-POSIX shells as well (not that it
    matters).
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:15:29 2024
    From Newsgroup: comp.lang.misc

    On Sat, 30 Mar 2024 01:30:53 +0100, Janis Papanagnou wrote:

    Besides the naming, keep in mind that there's a semantical differences between a "command", a "built-in command", and "shell construct". An
    example where you can observe operational differences is:
    '/bin/test' and '/bin/['
    'test' and '['
    '[['
    where (for example) the latter does not need quoting.

    I know that there are places in POSIX shells where the usual rules for interpretation of special-substitution markers are altered or suspended.
    But those situations are always delimited in some special way (distinctive syntactic constructs or reserved words). Throughout the entire rest of the language, the principles I have described still apply.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 01:21:09 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Fri, 29 Mar 2024 17:08:35 -0700, Keith Thompson wrote:

    "for" is not just a command. It's a keyword, part of the shell language
    syntax.

    Remember, that’s only true of POSIX shells

    Not necessarily. Bash is not a POSIX shell. It can be,
    but without special configuration it is not POSIX.

    ksh is as close as one might get to a true POSIX shell,
    but even ksh has extensions.

    But nitpicking aside, the context of the discussion that
    you responded to was about clearly POSIX-like shells.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David W. Hodgins@dwhodgins@nomail.afraid.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Mar 29 18:32:30 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 15:38:48 -0400, Johanne Fairchild <jfairchild@tudado.org> wrote:
    "David W. Hodgins" <dwhodgins@nomail.afraid.org> writes:

    [...]

    The terminology will continue to be used, but the distinction does not
    matter, except from a speed of processing difference.

    Just to share that I, personally, don't use the distinction. For
    instance, I say that

    "the answer is %.2f\n"

    is a program that builds a string given its usual context. I say that

    awk '1; { print "" }'

    is a program to double-space a file. I haven't said ``script'' in
    years.

    I still refer to text files, intended to be run through an interpreter such
    as bash, as scripts, while things like c text files that must be compiled to
    an object file and then linked to be executable as programs.

    Regards, Dave Hodgins
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 07:47:14 2024
    From Newsgroup: comp.lang.misc

    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted: >ram@zedat.fu-berlin.de (Stefan Ram) writes:
    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    A scripting language is a programming language made for a hypothetical >>>machine, not too different from a programming language made for a real >>>machine, one made of hardware.
    C is clearly a programming language, yet its specification
    says, "The semantic descriptions in this document describe
    the behavior of an abstract machine". And you cannot buy
    this abstract C machine as a piece of hardware anywhere!
    Of course. :) But we both know what that means. It's abstract because
    there are so many real machines for which this abstract one is an
    abstraction of. And the real ones are the target of the language.

    If you want to see it this way ...

    But look at Pascal, Java, or Python. They are usually compiled
    into an intermediate code (called "p-code" in the case of
    Pascal) which is then interpreted (the interpreter is called
    "JVM" in the case of Java). Yet, we think of Pascal and Java
    as programming languages and of Python as a scripting language.

    But this is actually an implementation detail: Java also can
    be compiled into machine code.

    In any case, we can write a small batch file "execute" which
    can be called for source code in any programming language and
    will execute it:

    execute Main.pas
    execute Main.java
    execute Main.py
    execute main.c
    execute main.cpp
    execute main.bas
    execute main.bat
    ...

    They all will print "Hello World". Whether the execution happens
    via translation to machine code or via interpretation by another
    program or by a mixture of both is just an implementation
    detail of "execute", that usually will not matter much for the
    programmer. And often for the same language, one is free to
    either compile it to machine language or interpret it via another
    program.

    Some language, like LISP or Python, have "eval": These languages
    still can be compiled, but they require an interpreter at run-
    time. Java often is executed by interpretation first, but when
    the "Hotspot" interpreter sees that some code is executed often,
    it will then decide /at run-time/ to compile it into actual
    machine code! (And there are Python implementations that run
    on the JVM.)

    How can such implementation details matter for the question whether
    a language is called a programming language or a scripting language,
    when the programmer often does not even need to know about them?

    Yes, there also are C interpreters IIRC, but they are rare.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 10:16:33 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 17:25:18 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote: >>>Scripting is an activity, a use case, not a language.

    So if I write a program to for example process some files in a directory by >> your argument its a script whether I write it in shell, python, C++ or
    assembler.

    I also wrote: "Scripting refers to executing commands which are so high
    level that they are entire applications or functional blocks within an >application."

    So if I write:

    int main()
    {
    system("ls | wc -l");
    return 0;
    }

    Thats a script? No? What if I use popen() or execve() then? Where do you
    draw the line?

    You're just being deliberately obtuse, not to mention snippy with the >scissors.

    I'm not being obtuse. There is no hard dividing line between scripts and programs - as I said, its shades of grey.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 10:19:46 2024
    From Newsgroup: comp.lang.misc

    On Fri, 29 Mar 2024 17:58:41 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    Were the mucky bits actually written in Lisp or was Lisp simply calling some >> routines written in assembler?

    Sorry, could you demarcate where exactly the goalposts are? Which mucky
    bits?

    Oh I dunno, the parts that walk a kernel memory structure for example.

    In kernels written in C, there are mucky bits in assembler, like
    entry and exit into an trap/interrupt handler. You usually can't save

    Sure, but far less that there would be in a higher level language.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 11:28:34 2024
    From Newsgroup: comp.lang.misc

    On 30.03.2024 08:47, Stefan Ram wrote:

    But look at Pascal, Java, or Python. They are usually compiled
    into an intermediate code (called "p-code" in the case of
    Pascal) which is then interpreted (the interpreter is called
    "JVM" in the case of Java). Yet, we think of Pascal and Java
    as programming languages and of Python as a scripting language.

    I never used an interpreted Pascal, nor one that produced p-code.
    (As far as memory serves it was the UCSD Pascal dialect that
    decided to use intermediate code to be interpreted.) My Pascal
    programs have always been compiled.

    And there were BASIC compilers on mainframes before the BASIC
    interpreters on PCs became popular and widespread.

    It's _the same_ language (modulo dialects), and languages are
    usually defined by their grammar and semantics and not whether
    it is interpreted/compiled or how it is run (VM or else).

    I think it's obvious that interpretation vs. compilation or any
    intermediate interpreted p-code is not an appropriate criterion
    to declare something as a "scripting" language. You can't tell
    whether a language, Pascal, BASIC, or any other language, is a
    "scripting" language by that criterion. It's also generally a
    fuzzy term; literature speaks vaguely about "typical" criteria
    but cannot pin them down. - And that term isn't even helpful in
    any way! - So why use it at all or religiously dispute about it.

    Janis


    But this is actually an implementation detail: Java also can
    be compiled into machine code.

    [...]


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 11:35:55 2024
    From Newsgroup: comp.lang.misc

    On 30.03.2024 11:16, Muttley@dastardlyhq.com wrote:

    I'm not being obtuse. There is no hard dividing line between scripts and programs - as I said, its shades of grey.

    The terms "script" and "scripting languages" are very fuzzy and
    just trying to be descriptive, but are effectively meaningless,
    the terms don't serve any practical purpose (in my book).

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Dmitry A. Kazakov@mailbox@dmitry-kazakov.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 12:44:37 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-29 02:14, Lawrence D'Oliveiro wrote:
    At one time, we distinguished between “scripting” languages and “programming” languages. To begin with, the “scripting” languages were
    somehow more limited in functionality than full-fledged “programming” languages. Or they were slower, because they were interpreted.
    [...]

    The key difference is that a program in a scripting language need not to
    be complete or known in order to be executed.

    The limitations and ugliness of scripting languages is determined by
    this requirement, but also easiness of use.
    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Christian Weisgerber@naddy@mips.inka.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 13:37:24 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-30, Stefan Ram <ram@zedat.fu-berlin.de> wrote:

    But look at Pascal, Java, or Python. They are usually compiled
    into an intermediate code (called "p-code" in the case of
    Pascal) which is then interpreted

    Pascal is usually compiled to machine code. UCSD Pascal with its
    intermediate p-code was an atypical case.
    --
    Christian "naddy" Weisgerber naddy@mips.inka.de
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 18:10:36 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-30, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 17:25:18 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote: >>>>Scripting is an activity, a use case, not a language.

    So if I write a program to for example process some files in a directory by
    your argument its a script whether I write it in shell, python, C++ or
    assembler.

    I also wrote: "Scripting refers to executing commands which are so high >>level that they are entire applications or functional blocks within an >>application."

    So if I write:

    int main()
    {
    system("ls | wc -l");
    return 0;
    }

    Thats a script?

    The "ls | wc -l" part is a script, passed off for execution to a
    language that mainly supports scripting.

    Note the non-scripting features here like "int main",
    which doesn't /do/ anything, and typically the need to compile
    and link this in order to run it.

    system() itself also isn't quite "command which is so high level that
    it's an inter application or functional block within an application";
    it's a shim whose argument might be such a command.

    No? What if I use popen() or execve() then? Where do you
    draw the line?

    If you use popen and execve, you're using more systems programming
    functional blocks that are not scripting commands.

    You're just being deliberately obtuse, not to mention snippy with the >>scissors.

    I'm not being obtuse. There is no hard dividing line between scripts and

    Right now you're doubling down on obtusity, by my estimate.

    programs - as I said, its shades of grey.

    Would you say, fifty shades?
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 19:32:05 2024
    From Newsgroup: comp.lang.misc

    On 29/03/2024 17:02, Muttley@dastardlyhq.com wrote:
    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg
    Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged
    programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp. Forth maybe, no idea.


    "Open Firmware" is an attempt to have device drivers for PCI cards (and
    other hardware) included in flash on the cards, in a processor and
    platform independent way. It uses Forth - so the device drivers are
    provided as Forth source code or byte-compiled Forth, and can then be
    executed with a simple Forth VM on the target system. They can also be
    JIT compiled for the target.

    <https://en.wikipedia.org/wiki/Open_Firmware>

    It didn't really take off very well, but certainly people have written
    device drivers in Forth.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 18:46:50 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-30, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 17:58:41 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    Were the mucky bits actually written in Lisp or was Lisp simply calling some
    routines written in assembler?

    Sorry, could you demarcate where exactly the goalposts are? Which mucky >>bits?

    Oh I dunno, the parts that walk a kernel memory structure for example.

    Well, since the kernel is written in Lisp, of course Lisp walks its own
    data structures.

    In a kernel, there often occur externally imposed memory structures,
    like for instance lists of entries in a DMA buffer ring above an
    ethernet device. Or banks of registers.

    The kernel-writing Lisp dialect would have provisions for dealing
    with binary structures like that.

    The following example is not from a Lisp operating system, or a Lisp
    that is known for operating system work. It's from my own application.

    It shows how in CCL (Clozure Common Lisp) (note: note the Z, not Clojure
    with a J) we can obtain a linked list C data structure and walk it,
    using some CCL-specific concepts; CCL provides #> notations for C
    types, and offsets into C structures and such.

    The GetAdaptersInfo Win32 API is called, filling the list into a stack-allocated buffer, with the help of CCL's %stack-block operator.
    We get a list of adapters, each of which is a list consisting of
    a list of the mac bytes, IP address list, name and description.

    (The information is then encrypted, hashed and tied to a software license, along with other bits of system info.)

    (defun get-network-interface-list ()
    (open-shared-library "iphlpapi.dll")
    (let ((blk-size 65536) ;; crude!
    (get-adapters-info (foreign-symbol-address "GetAdaptersInfo")))
    (if get-adapters-info
    (%stack-block ((blk blk-size))
    (rlet ((len-inout #>ULONG blk-size))
    (if (zerop (ff-call get-adapters-info :address blk
    :address len-inout
    #>DWORD))
    (loop for ptr = blk then (pref ptr #>IP_ADAPTER_INFO.Next)
    until (%null-ptr-p ptr)
    collecting
    (let ((alen (pref ptr #>IP_ADAPTER_INFO.AddressLength))
    (addr (pref ptr #>IP_ADAPTER_INFO.Address))
    (aname (pref ptr #>IP_ADAPTER_INFO.AdapterName))
    (descr (pref ptr #>IP_ADAPTER_INFO.Description))
    (iplist (pref ptr #>IP_ADAPTER_INFO.IpAddressList))
    (type (pref ptr #>IP_ADAPTER_INFO.Type)))
    (list type
    (loop for i below alen
    collecting (%get-unsigned-byte addr i)
    into mac-bytes
    finally
    (return (mac-bytes-to-string mac-bytes)))
    (get-ip-address-list iplist)
    (%get-cstring aname)
    (%get-cstring descr))))))))))

    CCL is compiled; this just turns into a machine language function
    poking at stack memory.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 19:25:58 2024
    From Newsgroup: comp.lang.misc

    ram@zedat.fu-berlin.de (Stefan Ram) writes:
    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted: >>ram@zedat.fu-berlin.de (Stefan Ram) writes:
    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    A scripting language is a programming language made for a hypothetical >>>>machine, not too different from a programming language made for a real >>>>machine, one made of hardware.
    C is clearly a programming language, yet its specification
    says, "The semantic descriptions in this document describe
    the behavior of an abstract machine". And you cannot buy
    this abstract C machine as a piece of hardware anywhere!
    Of course. :) But we both know what that means. It's abstract because >>there are so many real machines for which this abstract one is an >>abstraction of. And the real ones are the target of the language.

    If you want to see it this way ...

    But look at Pascal, Java, or Python. They are usually compiled
    into an intermediate code (called "p-code" in the case of
    Pascal) which is then interpreted (the interpreter is called
    "JVM" in the case of Java). Yet, we think of Pascal and Java
    as programming languages and of Python as a scripting language.

    VAX Pascal (1980) was compiled directly to VAX machine code, as was
    the Pascal compiler I wrote in the graduate compiler class.

    UCSD Pascal used p-code, and IIRC Borland picked up
    on that.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 19:27:05 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:
    On Fri, 29 Mar 2024 17:25:18 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote: >>>>Scripting is an activity, a use case, not a language.

    So if I write a program to for example process some files in a directory by
    your argument its a script whether I write it in shell, python, C++ or
    assembler.

    I also wrote: "Scripting refers to executing commands which are so high >>level that they are entire applications or functional blocks within an >>application."

    So if I write:

    int main()
    {
    system("ls | wc -l");
    return 0;
    }

    Thats a script? No? What if I use popen() or execve() then? Where do you
    draw the line?

    Technically, only the 'ls | wc -l' is a script. One that is passed
    to the default SHELL.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 20:19:25 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-30, David Brown <david.brown@hesbynett.no> wrote: ><https://en.wikipedia.org/wiki/Open_Firmware>

    It didn't really take off very well, but certainly people have written device drivers in Forth.

    Unfortunately, the device tree crap from Open Firmware took off.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 14:28:31 2024
    From Newsgroup: comp.lang.misc

    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
    On 2024-03-29 02:14, Lawrence D'Oliveiro wrote:
    At one time, we distinguished between “scripting” languages and
    “programming” languages. To begin with, the “scripting” languages were
    somehow more limited in functionality than full-fledged “programming”
    languages. Or they were slower, because they were interpreted.
    [...]

    The key difference is that a program in a scripting language need not
    to be complete or known in order to be executed.

    The limitations and ugliness of scripting languages is determined by
    this requirement, but also easiness of use.

    Perl, Python, and Lua are all considered scripting languages, and for
    all of them a syntax error at the end of a script will prevent any of it
    from being executed. The distinction is that they're not optimized for interactive use, as shell languages are (though they all can be used interactively).

    If you want to say that Python isn't a scripting language because of
    that, I won't argue, but others will.

    There are a lot of dividing lines (compiled to machine code vs. compiled
    to byte code (on each execution or just once) vs. interpreted (perhaps
    with JIT), interactive vs. batch, strong vs. weak typing, static
    vs. dynamic typing, etc.). None of them are rigorously defined, and
    none of them particularly need to be.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Christian Weisgerber@naddy@mips.inka.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Mar 30 21:48:11 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-30, Scott Lurndal <scott@slp53.sl.home> wrote:

    VAX Pascal (1980) was compiled directly to VAX machine code, as was
    the Pascal compiler I wrote in the graduate compiler class.

    UCSD Pascal used p-code, and IIRC Borland picked up
    on that.

    Borland's Turbo Pascal compiled to machine code.
    --
    Christian "naddy" Weisgerber naddy@mips.inka.de
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Dmitry A. Kazakov@mailbox@dmitry-kazakov.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Mar 31 22:06:50 2024
    From Newsgroup: comp.lang.misc

    On 2024-03-30 22:28, Keith Thompson wrote:
    "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
    On 2024-03-29 02:14, Lawrence D'Oliveiro wrote:
    At one time, we distinguished between “scripting” languages and
    “programming” languages. To begin with, the “scripting” languages were
    somehow more limited in functionality than full-fledged “programming” >>> languages. Or they were slower, because they were interpreted.
    [...]

    The key difference is that a program in a scripting language need not
    to be complete or known in order to be executed.

    The limitations and ugliness of scripting languages is determined by
    this requirement, but also easiness of use.

    Perl, Python, and Lua are all considered scripting languages, and for
    all of them a syntax error at the end of a script will prevent any of it
    from being executed. The distinction is that they're not optimized for interactive use, as shell languages are (though they all can be used interactively).

    I was not talking about [syntactically] incorrect incomplete programs.
    In a scripting language an incomplete program can be correct and
    executable. E.g. I type in bash:

    ls

    This is only a part of my program. Because then I inspect the output and
    type:

    rm foo.bar

    After that I turn off the computer. My program is complete now.
    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Mar 31 20:47:29 2024
    From Newsgroup: comp.lang.misc

    On Sat, 30 Mar 2024 00:14:42 +0100, Janis Papanagnou wrote:

    So what is 'for i in a ; do ... ; done' then in your world?

    ldo@theon:~> for i in a b c; do echo i; done
    i
    i
    i

    Like I said, in a shell language, you have the assumption that “everything is literal text until indicated otherwise”.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 08:31:17 2024
    From Newsgroup: comp.lang.misc

    On Sat, 30 Mar 2024 18:10:36 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-30, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    I also wrote: "Scripting refers to executing commands which are so high >>>level that they are entire applications or functional blocks within an >>>application."

    So if I write:

    int main()
    {
    system("ls | wc -l");
    return 0;
    }

    Thats a script?

    The "ls | wc -l" part is a script, passed off for execution to a
    language that mainly supports scripting.

    So its not a script.

    Note the non-scripting features here like "int main",
    which doesn't /do/ anything, and typically the need to compile
    and link this in order to run it.

    There may be plenty of surrounding code that does do something.

    No? What if I use popen() or execve() then? Where do you
    draw the line?

    If you use popen and execve, you're using more systems programming
    functional blocks that are not scripting commands.

    They both call high level commands so is it scripting or programming?

    I'm not being obtuse. There is no hard dividing line between scripts and

    Right now you're doubling down on obtusity, by my estimate.

    Perhaps you don't understand what being obtuse actually means.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 08:32:48 2024
    From Newsgroup: comp.lang.misc

    On Sat, 30 Mar 2024 18:46:50 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    (defun get-network-interface-list ()
    (open-shared-library "iphlpapi.dll")
    (let ((blk-size 65536) ;; crude!
    (get-adapters-info (foreign-symbol-address "GetAdaptersInfo")))
    (if get-adapters-info
    (%stack-block ((blk blk-size))
    (rlet ((len-inout #>ULONG blk-size))
    (if (zerop (ff-call get-adapters-info :address blk
    :address len-inout
    #>DWORD))
    (loop for ptr = blk then (pref ptr #>IP_ADAPTER_INFO.Next)
    until (%null-ptr-p ptr)
    collecting
    (let ((alen (pref ptr #>IP_ADAPTER_INFO.AddressLength))
    (addr (pref ptr #>IP_ADAPTER_INFO.Address))
    (aname (pref ptr #>IP_ADAPTER_INFO.AdapterName))
    (descr (pref ptr #>IP_ADAPTER_INFO.Description))
    (iplist (pref ptr #>IP_ADAPTER_INFO.IpAddressList))

    (type (pref ptr #>IP_ADAPTER_INFO.Type)))
    (list type
    (loop for i below alen
    collecting (%get-unsigned-byte addr i)
    into mac-bytes
    finally
    (return (mac-bytes-to-string mac-bytes)))

    (get-ip-address-list iplist)
    (%get-cstring aname)
    (%get-cstring descr))))))))))

    Ugh. No wonder the language fell out of fashion. Looks like some kind of hacked up Basic.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 06:49:48 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:

    On Sat, 30 Mar 2024 18:46:50 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    (defun get-network-interface-list ()
    (open-shared-library "iphlpapi.dll")
    (let ((blk-size 65536) ;; crude!
    (get-adapters-info (foreign-symbol-address "GetAdaptersInfo")))
    (if get-adapters-info
    (%stack-block ((blk blk-size))
    (rlet ((len-inout #>ULONG blk-size))
    (if (zerop (ff-call get-adapters-info :address blk
    :address len-inout
    #>DWORD))
    (loop for ptr = blk then (pref ptr #>IP_ADAPTER_INFO.Next)
    until (%null-ptr-p ptr)
    collecting
    (let ((alen (pref ptr #>IP_ADAPTER_INFO.AddressLength)) >> (addr (pref ptr #>IP_ADAPTER_INFO.Address))
    (aname (pref ptr #>IP_ADAPTER_INFO.AdapterName)) >> (descr (pref ptr #>IP_ADAPTER_INFO.Description)) >> (iplist (pref ptr #>IP_ADAPTER_INFO.IpAddressList))

    (type (pref ptr #>IP_ADAPTER_INFO.Type)))
    (list type
    (loop for i below alen
    collecting (%get-unsigned-byte addr i)
    into mac-bytes
    finally
    (return (mac-bytes-to-string mac-bytes)))

    (get-ip-address-list iplist)
    (%get-cstring aname)
    (%get-cstring descr))))))))))

    Ugh. No wonder the language fell out of fashion. Looks like some kind of hacked up Basic.

    Fashion and intelligence have never been very good friends.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 14:16:33 2024
    From Newsgroup: comp.lang.misc

    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    A scripting language is a programming language made for a hypothetical >machine, not too different from a programming language made for a real >machine, one made of hardware.

    I think of the type system:

    In a non-scripting programming language, the types often are
    based on hardware, like "16 bit integer", and typing is often
    handled in a static and rather strict way. Higher types, like
    strings whose size can change at run time, are often missing.

    Scripting languages are often less strictly typed, some rely entirely
    on strings which are interpreted as integers if necessary. Often
    one has no control over the internal represention of data, so one
    cannot access a library using the ABI or write a device driver in a
    scripting language. Explicit type conversions are rarely required.

    Also, resource handling:

    Scripting languages handle the memory for you. In a scripting
    language, you cannot call "malloc" to obtain the obligation to
    free this piece of memory exactly once in the future. They are
    garbage collected.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 14:47:15 2024
    From Newsgroup: comp.lang.misc

    On Mon, 01 Apr 2024 06:49:48 -0300
    Johanne Fairchild <jfairchild@tudado.org> wrote:
    Muttley@dastardlyhq.com writes:

    On Sat, 30 Mar 2024 18:46:50 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    (defun get-network-interface-list ()
    (open-shared-library "iphlpapi.dll")
    (let ((blk-size 65536) ;; crude!
    (get-adapters-info (foreign-symbol-address "GetAdaptersInfo")))
    (if get-adapters-info
    (%stack-block ((blk blk-size))
    (rlet ((len-inout #>ULONG blk-size))
    (if (zerop (ff-call get-adapters-info :address blk
    :address len-inout
    #>DWORD))
    (loop for ptr = blk then (pref ptr #>IP_ADAPTER_INFO.Next)
    until (%null-ptr-p ptr)
    collecting
    (let ((alen (pref ptr #>IP_ADAPTER_INFO.AddressLength))

    (addr (pref ptr #>IP_ADAPTER_INFO.Address))
    (aname (pref ptr #>IP_ADAPTER_INFO.AdapterName)) >>> (descr (pref ptr #>IP_ADAPTER_INFO.Description)) >>> (iplist (pref ptr >#>IP_ADAPTER_INFO.IpAddressList))

    (type (pref ptr #>IP_ADAPTER_INFO.Type)))
    (list type
    (loop for i below alen
    collecting (%get-unsigned-byte addr i) >>> into mac-bytes
    finally
    (return (mac-bytes-to-string >mac-bytes)))

    (get-ip-address-list iplist)
    (%get-cstring aname)
    (%get-cstring descr))))))))))

    Ugh. No wonder the language fell out of fashion. Looks like some kind of
    hacked up Basic.

    Fashion and intelligence have never been very good friends.

    Readability of the flow of control matters. God knows whats going on with
    all those nested statements.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andreas Eder@a_eder_muc@web.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 17:11:31 2024
    From Newsgroup: comp.lang.misc

    On Fr 29 Mär 2024 at 17:20, Muttley@dastardlyhq.com wrote:

    On Fri, 29 Mar 2024 17:13:47 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-03-29, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Fri, 29 Mar 2024 08:44:54 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Fri, 29 Mar 2024 09:55:33 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    My rule of thimb is that a scripting language is one whereby the
    source code can be run immediately by the interpreter, eg perl,
    python, regardless of what happens internally. A full fledged
    programming language is one that requires a compile/debug/link step
    first with the compiler and runtime (if required) being seperate. eg >>>>> Java, C

    By *that* logic, even Lisp and Forth don't count as "full-fledged >>>>programming languages" o_O Johanne's definition of a "scripting

    As a counter point, good luck writing a device driver in lisp.

    The Lisp machines had operating systems and device drivers written in
    Lisp, interrupt-driven and all. Where do you perceive the difficulty?

    Were the mucky bits actually written in Lisp or was Lisp simply calling some routines written in assembler? In the same sense that Python doesn't actually "do" AI, its way too slow, the AI but is done in libraries written in C++ that
    Python simply calls.

    It was Lisp all the way down. Even the machine langauge was quite lispy
    simply because the processor was a lisp chip.
    Go read about it - there is lots of info about it on the net and if you
    want, you can even run the lisp machines (several implementations) on an emulator.

    'Andreas
    --
    ceterum censeo redmondinem esse delendam
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 11:15:52 2024
    From Newsgroup: comp.lang.misc

    On 1 Apr 2024 14:16:33 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:

    In a non-scripting programming language, the types often are
    based on hardware, like "16 bit integer", and typing is often
    handled in a static and rather strict way. Higher types, like
    strings whose size can change at run time, are often missing.

    Notwithstanding the fuzziness granted by the use of "often" here, this
    doesn't seem like a terribly accurate assessment. Lots of compiled/ "non-scripting" languages - *however* you define that - have dynamic
    strings; even C++ provides that as part of the standard library
    (admittedly, not as a basic language construct, but that's C for you -
    *every* data structure is essentially pointers in a trenchcoat.) AFAIK
    it's much rarer to *lack* that capability; C does, for aforementioned
    reasons (although you can certainly roll your own,) O.G. Pascal did (as
    a hideous misfeature,) probably a few other current systems languages...
    but not many spring to mind.

    It's also not terribly true that "non-scripting" languages are pre-
    dominantly statically-typed. It's more common, certainly, but there are
    still a number of compiled applications languages with some kind of
    dynamic support. And while the division of number types into floating-
    point and integer is very frequently the case, most language standards
    don't specify word sizes that strictly (even in C, stdint.h wasn't
    introduced until C99 - which lead to headaches of its own, as anyone
    who's tried to run old code that makes assumptions about sizeof(int) on
    targets that break those assumptions can attest.) Plenty of "non-
    scripting" languages include or can be extended with support for
    arbitrary bignum types, as well.

    Scripting languages handle the memory for you. In a scripting
    language, you cannot call "malloc" to obtain the obligation to
    free this piece of memory exactly once in the future. They are
    garbage collected.

    And while this is pretty true of scripting languages, it doesn't make
    for a good point-of-contrast with "non-scripting" languages; *piles* of
    them include support for automatic memory management, and some (outside
    of the C family) don't even include facilities for doing it "by hand."

    Overall, this seems like a very narrow and C-centric view of programming language design - and while C is definitely *my* language-of-choice for application development,* let's not pretend it's the absolute be-all
    and end-all, as if there *could* be such a thing in a field as vast and
    diverse as this!

    * (Funnily enough, for a lot of "scripting" type jobs, my go-to is
    actually a compiled language - FreeBasic.)

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 18:25:54 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-01, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 01 Apr 2024 06:49:48 -0300
    Johanne Fairchild <jfairchild@tudado.org> wrote:
    Muttley@dastardlyhq.com writes:

    On Sat, 30 Mar 2024 18:46:50 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    (defun get-network-interface-list ()
    (open-shared-library "iphlpapi.dll")
    (let ((blk-size 65536) ;; crude!
    (get-adapters-info (foreign-symbol-address "GetAdaptersInfo"))) >>>> (if get-adapters-info
    (%stack-block ((blk blk-size))
    (rlet ((len-inout #>ULONG blk-size))
    (if (zerop (ff-call get-adapters-info :address blk
    :address len-inout
    #>DWORD))
    (loop for ptr = blk then (pref ptr #>IP_ADAPTER_INFO.Next) >>>> until (%null-ptr-p ptr)
    collecting
    (let ((alen (pref ptr #>IP_ADAPTER_INFO.AddressLength))

    (addr (pref ptr #>IP_ADAPTER_INFO.Address)) >>>> (aname (pref ptr #>IP_ADAPTER_INFO.AdapterName))
    (descr (pref ptr #>IP_ADAPTER_INFO.Description))
    (iplist (pref ptr >>#>IP_ADAPTER_INFO.IpAddressList))

    (type (pref ptr #>IP_ADAPTER_INFO.Type)))
    (list type
    (loop for i below alen
    collecting (%get-unsigned-byte addr i) >>>> into mac-bytes
    finally
    (return (mac-bytes-to-string >>mac-bytes)))

    (get-ip-address-list iplist)
    (%get-cstring aname)
    (%get-cstring descr))))))))))

    Ugh. No wonder the language fell out of fashion. Looks like some kind of >>> hacked up Basic.

    Fashion and intelligence have never been very good friends.

    Readability of the flow of control matters. God knows whats going on with
    all those nested statements.

    I didn't spend a lot of time on that code in the first place, and have
    not looked it in over ten years; yet it's trivially easily readable to me.

    Anyway, it's in a high level language, yet following a linked list of
    structs obtained from a Win32 function, which the code fetches into
    a buffer allocated efficiently on the native stack.

    The whole thing is compiled into native code.

    CCL's primitives for accessing the C stuff aren't pretty, but they are
    helpful. It's nice that it has the parsed information about the struct
    offsets, like #>IP_ADAPTER_INFO.AdapterName. I didn't have to define
    that anywhere. I remember it was pretty easy to figure the primtiies
    out from CCL's reference documentation. Easy to write, easy to read
    a decade later.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 19:42:05 2024
    From Newsgroup: comp.lang.misc

    John Ames <commodorejohn@gmail.com> writes:
    On 1 Apr 2024 14:16:33 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:


    Scripting languages handle the memory for you. In a scripting
    language, you cannot call "malloc" to obtain the obligation to
    free this piece of memory exactly once in the future. They are
    garbage collected.

    And while this is pretty true of scripting languages, it doesn't make
    for a good point-of-contrast with "non-scripting" languages; *piles* of
    them include support for automatic memory management, and some (outside
    of the C family) don't even include facilities for doing it "by hand."

    Indeed, and if you use the set (resources) rather than a member
    of the set (memory), even scripting languages allocate resources and
    must free them. E.g. temporary files, with some garbage collection
    (/tmp cleaners).

    Why is it important that there be a distinction between "scripting"
    and "non-scripting" languages at all?

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 13:25:31 2024
    From Newsgroup: comp.lang.misc

    On Mon, 01 Apr 2024 19:42:05 GMT
    scott@slp53.sl.home (Scott Lurndal) wrote:

    Why is it important that there be a distinction between "scripting"
    and "non-scripting" languages at all?

    Oh, it's an interesting question from a general standpoint, and I think
    you could make an argument that it'd be "useful" to someone trying to
    determine what the right tool for a given job would be.* The problem
    seems to be that *A.* we're arguing from several wildly different
    definitions of "scripting language" - is it a matter of problem domain? Implementation details? Both? Phase of the moon? - and nobody seems to
    want to budge on their preferred line, and *B.* even with a given
    definition, it's not exactly a firm line.

    * (Funny story - when I was a young'un first dabbling with computer programming, I got the impression that a lot of DOS games were written
    in Batch, of all things, because that was how you invoked them, and
    spent several confused days poring over the MS documentation trying to
    figure out how they could've done it!)

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 13:44:57 2024
    From Newsgroup: comp.lang.misc

    On Mon, 1 Apr 2024 11:15:52 -0700
    John Ames <commodorejohn@gmail.com> wrote:

    And while this is pretty true of scripting languages, it doesn't make
    for a good point-of-contrast with "non-scripting" languages; *piles*
    of them include support for automatic memory management, and some
    (outside of the C family) don't even include facilities for doing it
    "by hand."

    And, in fact, C actually does one specific bit of automatic memory
    management itself - the stack, which may or may not even *be* a true
    hardware stack (depending on the architecture,) and which is handled in
    an entirely transparent fashion* by compiler-generated entry/exit code generated by the compiler for each function.

    * (Until you go and pass a pointer to a local variable to some piece of
    code that expects it to still be valid later, natch.)

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 21:13:42 2024
    From Newsgroup: comp.lang.misc

    John Ames <commodorejohn@gmail.com> wrote or quoted:
    And, in fact, C actually does one specific bit of automatic memory
    management itself - the stack, which may or may not even *be* a true
    hardware stack (depending on the architecture,) and which is handled in
    an entirely transparent fashion* by compiler-generated entry/exit code >generated by the compiler for each function.

    This stack "management" is "limited" in C:

    |Unfortunately, the notion of stack overflow is not mentioned
    |by the standard or the standard’s rationale at all. This is
    |very troublesome, as for most actual implementations stack
    |overflow is a real problem.
    ...
    |in a real C implementation, a call like f(10000000) will not
    |return 10000000, but instead will crash with a message like
    |"segmentation fault". Furthermore, stack overflow does not
    |necessarily have to result in a crash with a nice error
    |message, but might also overwrite non-stack parts of the
    |memory (possibly putting the address of virus code there).
    |Stack overflow even can occur without function calls. For
    |example, the program int main(void) { int a[10000000]; }
    ...
    "Subtleties of the ANSI/ISO C standard" (2012); Robbert
    Krebbers, Freek Wiedijk; Radboud University Nijmegen.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 14:30:42 2024
    From Newsgroup: comp.lang.misc

    On 1 Apr 2024 21:13:42 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:

    This stack "management" is "limited" in C:

    True enough, although as noted that's an implementation issue as much
    as it is a limitation of the language spec. (I'm not sure how you could
    handle that in a way that's both robust and reasonably C-ish...)

    |Stack overflow even can occur without function calls. For
    |example, the program int main(void) { int a[10000000]; }

    But I did have to have a chuckle at this reminder of the days when "try
    to allocate < 40 MB on the stack" meant "automatic segfault." A lotta
    modern developers should've had to cut their teeth in an environment
    like that...!

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 21:41:56 2024
    From Newsgroup: comp.lang.misc

    On Mon, 1 Apr 2024 08:32:48 -0000 (UTC), Muttley wrote:

    Ugh. No wonder the language fell out of fashion. Looks like some kind of hacked up Basic.

    The BASIC comparison is just ignorant, but a lot of the ugliness comes
    from the traditional “parenthesis pileup” layout. I prefer to write my LISP code in a different way.

    One of the key things about LISP is homoiconicity. That is, the language explicitly includes an AST representation made out of objects defined in
    the language itself. This allows for a robust token-based macro facility,
    for example. Contrast this with the fiddliness and fragility of #define in
    C and C++, for example.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 21:43:23 2024
    From Newsgroup: comp.lang.misc

    On 1 Apr 2024 14:16:33 GMT, Stefan Ram wrote:

    Scripting languages handle the memory for you.

    If I were to link compiled C code against a runtime that includes a
    garbage collector, would that turn it into a “scripting” language?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 22:40:31 2024
    From Newsgroup: comp.lang.misc

    John Ames <commodorejohn@gmail.com> writes:
    On 1 Apr 2024 21:13:42 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:

    This stack "management" is "limited" in C:

    True enough, although as noted that's an implementation issue as much
    as it is a limitation of the language spec. (I'm not sure how you could >handle that in a way that's both robust and reasonably C-ish...)

    Modern (64-bit) linux systems leave large buffer zones (unmapped addresses)
    on either side of the stack; a stack overflow or underflow will
    immediately fault if the RLIMIT_STACK value is exceeded.


    |Stack overflow even can occur without function calls. For
    |example, the program int main(void) { int a[10000000]; }

    POSIX and linux systems support limiting the amount of address
    space an individual users stack can consume. 8MB is the default
    on many linux distributions.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 15:56:11 2024
    From Newsgroup: comp.lang.misc

    ram@zedat.fu-berlin.de (Stefan Ram) writes:
    John Ames <commodorejohn@gmail.com> wrote or quoted:
    And, in fact, C actually does one specific bit of automatic memory >>management itself - the stack, which may or may not even *be* a true >>hardware stack (depending on the architecture,) and which is handled in
    an entirely transparent fashion* by compiler-generated entry/exit code >>generated by the compiler for each function.

    This stack "management" is "limited" in C:

    |Unfortunately, the notion of stack overflow is not mentioned
    |by the standard or the standard’s rationale at all. This is
    |very troublesome, as for most actual implementations stack
    |overflow is a real problem.
    ...
    |in a real C implementation, a call like f(10000000) will not
    |return 10000000, but instead will crash with a message like
    |"segmentation fault". Furthermore, stack overflow does not
    |necessarily have to result in a crash with a nice error
    |message, but might also overwrite non-stack parts of the
    |memory (possibly putting the address of virus code there).
    |Stack overflow even can occur without function calls. For
    |example, the program int main(void) { int a[10000000]; }
    ...
    "Subtleties of the ANSI/ISO C standard" (2012); Robbert
    Krebbers, Freek Wiedijk; Radboud University Nijmegen.

    Available online at :

    https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1637.pdf
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 00:19:44 2024
    From Newsgroup: comp.lang.misc

    On Mon, 1 Apr 2024 13:44:57 -0700, John Ames wrote:

    ... the stack, which may or may not even *be* a true
    hardware stack (depending on the architecture,) ...

    This reinforces the point I made elsewhere about abstract machines being layered on top of other abstract machines, such that the line between “hardware” and “software” really becomes arbitrary.

    What constitutes a “true” hardware stack? Does it have to be a reserved area, like page 1 on the 6502 family? Does the use of a particular
    register as a stack pointer have to be defined by the instruction set, or
    just by the ABI, as in many RISC architectures?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 00:20:31 2024
    From Newsgroup: comp.lang.misc

    On Mon, 01 Apr 2024 19:42:05 GMT, Scott Lurndal wrote:

    Why is it important that there be a distinction between "scripting" and "non-scripting" languages at all?

    Particularly since the point of this thread is that there isn’t an
    important one.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 21:26:19 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:

    [...]

    Readability of the flow of control matters. God knows whats going on with
    all those nested statements.

    You don't seem to much of a Lisp writer. Lisp writers have no problem
    reading that indentation.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 00:57:23 2024
    From Newsgroup: comp.lang.misc

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 1 18:18:32 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    No.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 03:01:42 2024
    From Newsgroup: comp.lang.misc

    On Mon, 01 Apr 2024 18:18:32 -0700, Keith Thompson wrote:

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

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    No.

    Don’t quote so deeply, then.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 07:56:48 2024
    From Newsgroup: comp.lang.misc

    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    You don't seem to much of a Lisp writer. Lisp writers have no problem >reading that indentation.

    Well, there is the expression "write-only code", which shows
    that a good Lisp writer may not necessarily be a good reader.

    This is an example of LISP code:

    ( SETQ DIFF
    ( LAMBDA( X )
    ( COND
    ( ( ATOMP X )
    ( COND
    ( ( = X 'X )
    1 )
    ( T
    0 )))
    ( T
    ( COND
    ( ( =( CAR X )'SUM )
    ( LIST 'SUM( DIFF( CADR X ))( DIFF( CADDR X )))))))))

    . For someone who has not learned LISP, this is difficult to read,
    /not/ because of the indentation, but because the words used have no
    meaning for him. Without the indentation it would be harder to read.

    It defines ("SETQ") the name "DIFF" to be a function ("LAMBDA")
    of one argument ("X"). When called, the functions tests
    ("COND") whether X is an atom ("ATOMP X"). In this case,
    if X is the letter "X" the result is one, otherwise it's zero.
    If X is not a atom, but a sum, we will return the sum of the
    DIFFs of the augend and the added. This calls the same function
    as the one defined. Yes! In LISP a function may call itself!
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 08:18:48 2024
    From Newsgroup: comp.lang.misc

    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
    ( SETQ DIFF
    ( LAMBDA( X )
    ( COND
    ( ( ATOMP X )
    ( COND
    ( ( = X 'X )
    1 )
    ( T
    0 )))
    ( T
    ( COND
    ( ( =( CAR X )'SUM )
    ( LIST 'SUM( DIFF( CADR X ))( DIFF( CADDR X )))))))))

    In Python:

    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str
    else[ 'sum', diff( x[ 1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    . An attempt at indentation:

    def diff( x ):
    return \
    1 if x == 'x' else 0 \
    if type( x )is str else \
    [ 'sum', diff( x[ 1 ]), diff( x[ 2 ])] \
    if x[ 0 ]== 'sum' else None

    . In a multiple-returns style:

    def diff( x ):
    if type( x )is str:
    if x == 'x':
    return 1
    else:
    return 0
    else:
    if x[ 0 ]== 'sum':
    return [ 'sum', diff( x[ 1 ]), diff( x[ 2 ])]

    .
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 08:26:14 2024
    From Newsgroup: comp.lang.misc

    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str
    else[ 'sum', diff( x[ 1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    Oops! That was one long line starting with "return";
    it was wrapped by the newsreader, but is not correct
    Python anymore when wrapped this way.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 05:13:13 2024
    From Newsgroup: comp.lang.misc

    On 4/1/24 15:42, Scott Lurndal wrote:
    ...
    Why is it important that there be a distinction between "scripting"
    and "non-scripting" languages at all?

    I don't know, which is why this discussion bores me. But when people
    aren't in agreement about the definition of a term, it's often useful to consider what you might want to say using the term - not what you want
    to say about the definition, but what you want to say that can be
    non-trivially derived from the definition. Then you should carefully
    choose a definition for the term so that makes what you want to say
    about it both true, and even more important, useful.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 05:28:15 2024
    From Newsgroup: comp.lang.misc

    On 4/1/24 20:57, Lawrence D'Oliveiro wrote:
    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    By that same logic, if water is good, more water should be better. Tell
    that to someone who is drowning.
    For that matter, tell it to my mother who had a dangerous drug
    interaction involving a diuretic, while (unknown to her doctor) she was following a recommendation that she drink 8 glasses of water a day "for
    her health". Look up hyponatremia.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From candycanearter07@candycanearter07@candycanearter07.nomail.afraid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 15:30:09 2024
    From Newsgroup: comp.lang.misc

    Scott Lurndal <scott@slp53.sl.home> wrote at 22:40 this Monday (GMT):
    John Ames <commodorejohn@gmail.com> writes:
    On 1 Apr 2024 21:13:42 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:

    This stack "management" is "limited" in C:

    True enough, although as noted that's an implementation issue as much
    as it is a limitation of the language spec. (I'm not sure how you could >>handle that in a way that's both robust and reasonably C-ish...)

    Modern (64-bit) linux systems leave large buffer zones (unmapped addresses) on either side of the stack; a stack overflow or underflow will
    immediately fault if the RLIMIT_STACK value is exceeded.

    It still protects writing to memory outside that buffer, right?
    [snip]
    --
    user <candycane> is generated from /dev/urandom
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 08:43:04 2024
    From Newsgroup: comp.lang.misc

    On Tue, 2 Apr 2024 15:30:09 -0000 (UTC)
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    wrote:

    It still protects writing to memory outside that buffer, right?
    [snip]

    "Protecting memory" doesn't mean "no page fault," though, just that it
    won't scribble all over some other process's memory. But I am curious
    how universally various freenix distributions these days just let the application segfault vs. using that as a cue to allocate additional
    stack space; a quick test with WSL (Debian somethingorother) runs that
    test without complaint, but I don't have a genuine *nix box to hand to
    try it with.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 16:09:38 2024
    From Newsgroup: comp.lang.misc

    John Ames <commodorejohn@gmail.com> writes:
    On Tue, 2 Apr 2024 15:30:09 -0000 (UTC)
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    wrote:

    It still protects writing to memory outside that buffer, right?
    [snip]

    "Protecting memory" doesn't mean "no page fault," though, just that it
    won't scribble all over some other process's memory.

    The regions each side of the stack are marked not-present. This supports automatic stack expansion, within the resource limit for the stack on
    one side, and will produce a SIGSEGV or SIGBUS on the other end.


    But I am curious
    how universally various freenix distributions these days just let the >application segfault vs. using that as a cue to allocate additional
    stack space; a quick test with WSL (Debian somethingorother) runs that
    test without complaint, but I don't have a genuine *nix box to hand to
    try it with.

    All linux will allocate space, up to the stack resource limit.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 16:18:24 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-02, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
    Johanne Fairchild <jfairchild@tudado.org> wrote or quoted:
    You don't seem to much of a Lisp writer. Lisp writers have no problem >>reading that indentation.

    Well, there is the expression "write-only code", which shows
    that a good Lisp writer may not necessarily be a good reader.

    This is an example of LISP code:

    ( SETQ DIFF
    ( LAMBDA( X )
    ( COND
    ( ( ATOMP X )
    ( COND
    ( ( = X 'X )
    1 )
    ( T
    0 )))
    ( T
    ( COND
    ( ( =( CAR X )'SUM )
    ( LIST 'SUM( DIFF( CADR X ))( DIFF( CADDR X )))))))))

    . For someone who has not learned LISP, this is difficult to read,
    /not/ because of the indentation, but because the words used have no
    meaning for him. Without the indentation it would be harder to read.

    I know all the words. It's still hard to read because of the weird
    spaces.

    This is the way of writing the code that the vast majority of the Lisp
    word since gravitated toward:

    (SETQ DIFF
    (LAMBDA (X)
    (COND
    ((ATOMP X)
    (COND
    ((= X 'X) 1) ;; unnecessary line breaks shored up here
    (T 0)))
    (T
    (COND
    ((= (CAR X) 'SUM)
    (LIST 'SUM (DIFF (CADR X)) (DIFF (CADDR X)))))))))

    The code is from just before MacCarthy invented the ternary IF, as a
    shorthand for a one clause cond:

    (SETQ DIFF
    (LAMBDA (X)
    (IF (ATOM X)
    (IF (= X 'X) 1 0)
    (IF (= (CAR X) 'SUM)
    (LIST 'SUM (DIFF (CADR X)) (DIFF (CADDR X)))))))

    Also, modern cond clauses are not strictly pairs,
    which allows the T to be omitted:

    (cond (this that) (else)) ;; rather than (t else)

    when a cond clause consists of a single expression, then if that
    expression is true, cond stops and yields that expression's value.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 16:33:11 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-02, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
    ( SETQ DIFF
    ( LAMBDA( X )
    ( COND
    ( ( ATOMP X )
    ( COND
    ( ( = X 'X )
    1 )
    ( T
    0 )))
    ( T
    ( COND
    ( ( =( CAR X )'SUM )
    ( LIST 'SUM( DIFF( CADR X ))( DIFF( CADDR X )))))))))

    In Python:

    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str
    else[ 'sum', diff( x[ 1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    n TXR Lisp:

    (defun-match dif
    ((sum @left @right) ^(sum ,(dif left) ,(dif right)))
    ((@op . @args) (error "~s: unrecognized operator: ~s" 'dif op))
    (x 1)
    (@else 0))

    diff is a built in, which we don't want to be redefining without
    an exceptionally good reason, so I changed to dif.

    If we compile 'dif we get unused variable warnings:

    2> (compile 'dif)
    ** expr-1:1: warning: let*: variable args unused
    ** expr-1:1: warning: let*: variable else unused
    #<vm fun: 0 param + 3 optional + variadic>

    To suppress that, we use @nil instead of @args or @else; @nil is a
    placeholder pattern that matches any object without binding a variable.

    Otherwise we need more verbiage:

    ((@op . @args) (ignore args) (error ....))
    ...
    (@else (ignore else) 0)
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 15:20:06 2024
    From Newsgroup: comp.lang.misc

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

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    Too much of a good thing is a bad thing.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From candycanearter07@candycanearter07@candycanearter07.nomail.afraid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 18:50:11 2024
    From Newsgroup: comp.lang.misc

    Scott Lurndal <scott@slp53.sl.home> wrote at 16:09 this Tuesday (GMT):
    John Ames <commodorejohn@gmail.com> writes:
    On Tue, 2 Apr 2024 15:30:09 -0000 (UTC)
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
    wrote:

    It still protects writing to memory outside that buffer, right?
    [snip]

    "Protecting memory" doesn't mean "no page fault," though, just that it >>won't scribble all over some other process's memory.

    The regions each side of the stack are marked not-present. This supports automatic stack expansion, within the resource limit for the stack on
    one side, and will produce a SIGSEGV or SIGBUS on the other end.


    But I am curious
    how universally various freenix distributions these days just let the >>application segfault vs. using that as a cue to allocate additional
    stack space; a quick test with WSL (Debian somethingorother) runs that
    test without complaint, but I don't have a genuine *nix box to hand to
    try it with.

    All linux will allocate space, up to the stack resource limit.


    Interesting.
    --
    user <candycane> is generated from /dev/urandom
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 18:58:01 2024
    From Newsgroup: comp.lang.misc

    In article <87plv762zt.fsf@tudado.org>,
    Johanne Fairchild <jfairchild@tudado.org> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    Too much of a good thing is a bad thing.

    By definition. Because the definition of "too much" implies having crossed into the zone of being a bad thing.

    I would like to argue that there are things that there is no such thing as
    too much of, but I can't think of any examples off hand.
    --

    First of all, I do not appreciate your playing stupid here at all.

    - Thomas 'PointedEars' Lahn -
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 18:59:00 2024
    From Newsgroup: comp.lang.misc

    gazelle@shell.xmission.com (Kenny McCormack) writes:
    In article <87plv762zt.fsf@tudado.org>,
    Johanne Fairchild <jfairchild@tudado.org> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    Too much of a good thing is a bad thing.

    By definition. Because the definition of "too much" implies having crossed >into the zone of being a bad thing.

    I would like to argue that there are things that there is no such thing as >too much of, but I can't think of any examples off hand.

    Money?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Dmitry A. Kazakov@mailbox@dmitry-kazakov.de to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 22:05:18 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-02 20:59, Scott Lurndal wrote:
    gazelle@shell.xmission.com (Kenny McCormack) writes:
    In article <87plv762zt.fsf@tudado.org>,
    Johanne Fairchild <jfairchild@tudado.org> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    Too much of a good thing is a bad thing.

    By definition. Because the definition of "too much" implies having crossed >> into the zone of being a bad thing.

    I would like to argue that there are things that there is no such thing as >> too much of, but I can't think of any examples off hand.

    Money?

    Inflation.
    --
    Regards,
    Dmitry A. Kazakov
    http://www.dmitry-kazakov.de

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From James Kuyper@jameskuyper@alumni.caltech.edu to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 2 19:15:13 2024
    From Newsgroup: comp.lang.misc

    On 4/2/24 14:59, Scott Lurndal wrote:
    gazelle@shell.xmission.com (Kenny McCormack) writes:
    ...
    I would like to argue that there are things that there is no such thing as >> too much of, but I can't think of any examples off hand.

    Money?

    If you have lots of moeny, and insufficient protection, you can be in
    danger. Also, a sufficiently large amount of money can crush you.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 00:23:12 2024
    From Newsgroup: comp.lang.misc

    On 2 Apr 2024 08:26:14 GMT, Stefan Ram wrote:

    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:

    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str else[ 'sum', diff( x[
    1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    Oops! That was one long line starting with "return";
    it was wrapped by the newsreader, but is not correct Python anymore
    when wrapped this way.

    It’s bloody horrible Python even when wrapped correctly. I think Python’s version of the conditional expression is a complete abortion.

    How about this, to at least get things the same way round as in the more
    usual C-style conditional expression:

    def diff(x) :
    return \
    [
    lambda :
    [
    lambda :
    [
    lambda : None,
    lambda : ['sum', diff(x[1]), diff(x[2])],
    ][x[0] == 'sum'](),
    lambda : 0,
    ][isinstance(x, str)](),
    lambda : 1,
    ][x == 'x']()
    #end diff
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 00:23:38 2024
    From Newsgroup: comp.lang.misc

    On Tue, 02 Apr 2024 15:20:06 -0300, Johanne Fairchild wrote:

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

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    Too much of a good thing is a bad thing.

    Should that principle be carried to excess, though?
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 00:25:37 2024
    From Newsgroup: comp.lang.misc

    On Tue, 2 Apr 2024 05:28:15 -0400, James Kuyper wrote:

    By that same logic, if water is good, more water should be better. Tell
    that to someone who is drowning.

    Now there would be an example of too much logic, if you really want to
    discuss such a thing with someone who is drowning, would it not?

    ... she was following a recommendation that she drink 8 glasses of water
    a day "for her health".

    Also look up “water intoxication”. Can kill anybody.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 09:50:28 2024
    From Newsgroup: comp.lang.misc

    On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:
    On 2 Apr 2024 08:26:14 GMT, Stefan Ram wrote:

    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:

    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str else[ 'sum', diff( x[ >>> 1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    Oops! That was one long line starting with "return";
    it was wrapped by the newsreader, but is not correct Python anymore
    when wrapped this way.

    It’s bloody horrible Python even when wrapped correctly. I think Python’s version of the conditional expression is a complete abortion.


    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief
    mention in a tutorial on Python conditionals showing how to write normal conditionals in the language. I think Python stole this one from Perl.


    How about this, to at least get things the same way round as in the more usual C-style conditional expression:

    def diff(x) :
    return \
    [
    lambda :
    [
    lambda :
    [
    lambda : None,
    lambda : ['sum', diff(x[1]), diff(x[2])],
    ][x[0] == 'sum'](),
    lambda : 0,
    ][isinstance(x, str)](),
    lambda : 1,
    ][x == 'x']()
    #end diff

    How about just writing Python code the way pretty much everyone else
    writes Python code? In a simple and obvious manner :

    def diff(x) :
    if x == 'x' :
    return 1
    if isinstance(x, str) :
    return 0
    if x[0] == 'sum' :
    return ['sum', diff(x[1]), diff(x[2])]
    return None




    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 07:53:28 2024
    From Newsgroup: comp.lang.misc

    On Wed, 3 Apr 2024 09:50:28 +0200, David Brown wrote:

    How about just writing Python code the way pretty much everyone else
    writes Python code?

    That can be generalized to switch-expressions as well. See my notebook on “Simple Code-Shortening Idioms” at <https://gitlab.com/ldo/python_topics_notebooks/>.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Johanne Fairchild@jfairchild@tudado.org to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 07:18:07 2024
    From Newsgroup: comp.lang.misc

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

    On Tue, 02 Apr 2024 15:20:06 -0300, Johanne Fairchild wrote:

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

    On Mon, 01 Apr 2024 21:26:19 -0300, Johanne Fairchild wrote:

    reading that indentation.

    If indentation is good, more indentation should be better.

    Too much of a good thing is a bad thing.

    Should that principle be carried to excess, though?

    Surely not if it's a good thing. :-)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Richard Kettlewell@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 15:45:54 2024
    From Newsgroup: comp.lang.misc

    scott@slp53.sl.home (Scott Lurndal) writes:
    John Ames <commodorejohn@gmail.com> writes:
    On 1 Apr 2024 21:13:42 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:

    This stack "management" is "limited" in C:

    True enough, although as noted that's an implementation issue as much
    as it is a limitation of the language spec. (I'm not sure how you could >>handle that in a way that's both robust and reasonably C-ish...)

    Modern (64-bit) linux systems leave large buffer zones (unmapped addresses) on either side of the stack; a stack overflow or underflow will
    immediately fault if the RLIMIT_STACK value is exceeded.

    ...unless it’s exceeded by enough to reach some other mapped address.

    https://blog.qualys.com/vulnerabilities-threat-research/2017/06/19/the-stack-clash
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 07:53:42 2024
    From Newsgroup: comp.lang.misc

    On Wed, 3 Apr 2024 09:50:28 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:
    It’s bloody horrible Python even when wrapped correctly. I think Python’s version of the conditional expression is a complete
    abortion.
    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a
    brief mention in a tutorial on Python conditionals showing how to
    write normal conditionals in the language. I think Python stole this
    one from Perl.
    It's a real "Doc, it hurts when I do this!" situation.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 09:00:25 2024
    From Newsgroup: comp.lang.misc

    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:
    On 2 Apr 2024 08:26:14 GMT, Stefan Ram wrote:

    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:

    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str else[ 'sum', diff( x[ >>>> 1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    Oops! That was one long line starting with "return";
    it was wrapped by the newsreader, but is not correct Python anymore
    when wrapped this way.
    It’s bloody horrible Python even when wrapped correctly. I think
    Python’s version of the conditional expression is a complete
    abortion.

    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.

    No, Perl's conditional expressions use the same syntax as C's.

    As for whether Python's conditional expression syntax, it's not clear
    that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else
    expr2) (unless you happen to be familiar with one of them).
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Richard Kettlewell@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 17:16:31 2024
    From Newsgroup: comp.lang.misc

    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:
    It’s bloody horrible Python even when wrapped correctly. I think
    Python’s version of the conditional expression is a complete
    abortion.

    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief
    mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.

    No, Perl's conditional expressions use the same syntax as C's.

    As for whether Python's conditional expression syntax, it's not clear
    that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else expr2) (unless you happen to be familiar with one of them).

    I’ve been familiar with both for years and I think the Python version is awful; in particular the ordering is a bizarre choice. The PEP where
    they worked out the design acknowledges this but then they went ahead
    and did it anyway...
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 18:30:08 2024
    From Newsgroup: comp.lang.misc

    On 03/04/2024 18:00, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:
    On 2 Apr 2024 08:26:14 GMT, Stefan Ram wrote:

    ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:

    def diff( x ):
    return 1 if x == 'x' else 0 if type( x )is str else[ 'sum', diff( x[ >>>>> 1 ]), diff( x[ 2 ])]
    if x[ 0 ]== 'sum' else None

    Oops! That was one long line starting with "return";
    it was wrapped by the newsreader, but is not correct Python anymore >>>> when wrapped this way.
    It’s bloody horrible Python even when wrapped correctly. I think
    Python’s version of the conditional expression is a complete
    abortion.

    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief
    mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.

    No, Perl's conditional expressions use the same syntax as C's.

    I am not very familiar with Perl, and don't know what are expressions or statements. Perhaps I have been imagining things. I had the idea that
    in Perl you could write "<do_this> if <condition>" as an alternative to
    the more common imperative language ordering "if <condition> then
    <do_this>".


    As for whether Python's conditional expression syntax, it's not clear
    that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else expr2) (unless you happen to be familiar with one of them).


    I think expr1 and expr2 belong naturally together, as you are selecting
    one or the other. If you are using a short-circuit evaluation, you
    would express it in words as "evaluate cond, and based on that, evaluate either expr1 and expr2". Having "expr1" first is a bit like a recipe
    that says "add the sugar to the egg whites, having first beaten the egg whites". It is an ordering that does not suit well in an imperative
    language (I know Python is multi-paradigm, but it is basically imperative).

    But I agree that familiarity could be a big factor in my subjective
    opinion here.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 16:56:25 2024
    From Newsgroup: comp.lang.misc

    Richard Kettlewell <invalid@invalid.invalid> writes:
    scott@slp53.sl.home (Scott Lurndal) writes:
    John Ames <commodorejohn@gmail.com> writes:
    On 1 Apr 2024 21:13:42 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:

    This stack "management" is "limited" in C:

    True enough, although as noted that's an implementation issue as much
    as it is a limitation of the language spec. (I'm not sure how you could >>>handle that in a way that's both robust and reasonably C-ish...)

    Modern (64-bit) linux systems leave large buffer zones (unmapped addresses) >> on either side of the stack; a stack overflow or underflow will
    immediately fault if the RLIMIT_STACK value is exceeded.

    ...unless it’s exceeded by enough to reach some other mapped address.

    https://blog.qualys.com/vulnerabilities-threat-research/2017/06/19/the-stack-clash

    Yes, clearly the buffer zones must be limited in size to allow space
    for the rest of the application (and note that most extant processors
    limit the virtual address space to 44 or 48 bits (up to 52 on ARM64)).

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 10:19:55 2024
    From Newsgroup: comp.lang.misc

    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 18:00, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    [...]
    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief
    mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.
    No, Perl's conditional expressions use the same syntax as C's.

    I am not very familiar with Perl, and don't know what are expressions
    or statements. Perhaps I have been imagining things. I had the idea
    that in Perl you could write "<do_this> if <condition>" as an
    alternative to the more common imperative language ordering "if
    <condition> then <do_this>".

    Yes, but it's not the same thing. Perl has postfix conditionals, so you
    can write:

    statement if condition;

    but that's a statement, not an expression, and there's no form
    equivalent to if/else. It's a specific case of "statement modifiers",
    where the keyword can be any of if, unless, while, until, for, foreach,
    or when. (The latter is for an experimental "switch" feature, disabled
    by default in recent releases.)

    https://perldoc.perl.org/perlsyn#Statement-Modifiers

    As for whether Python's conditional expression syntax, it's not
    clear
    that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else
    expr2) (unless you happen to be familiar with one of them).

    I think expr1 and expr2 belong naturally together, as you are
    selecting one or the other. If you are using a short-circuit
    evaluation, you would express it in words as "evaluate cond, and based
    on that, evaluate either expr1 and expr2". Having "expr1" first is a
    bit like a recipe that says "add the sugar to the egg whites, having
    first beaten the egg whites". It is an ordering that does not suit
    well in an imperative language (I know Python is multi-paradigm, but
    it is basically imperative).

    But I agree that familiarity could be a big factor in my subjective
    opinion here.

    I don't have a strong opinion one way or the other, beyond a willingness
    to accept the syntax and other rules of whatever language I'm using.
    But I suggest that Python's "expr1 if condition else expr2" is intended
    to emphasize expr1 over expr2, treating the condition being true as the "normal" case. That's not necessarily a bad thing.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 21:33:58 2024
    From Newsgroup: comp.lang.misc

    On 03/04/2024 19:19, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 18:00, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    [...]
    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief >>>> mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.
    No, Perl's conditional expressions use the same syntax as C's.

    I am not very familiar with Perl, and don't know what are expressions
    or statements. Perhaps I have been imagining things. I had the idea
    that in Perl you could write "<do_this> if <condition>" as an
    alternative to the more common imperative language ordering "if
    <condition> then <do_this>".

    Yes, but it's not the same thing. Perl has postfix conditionals, so you
    can write:

    statement if condition;

    but that's a statement, not an expression, and there's no form
    equivalent to if/else. It's a specific case of "statement modifiers",
    where the keyword can be any of if, unless, while, until, for, foreach,
    or when. (The latter is for an experimental "switch" feature, disabled
    by default in recent releases.)

    OK. That's a lot more than I knew.

    However, I don't see a relevant distinction between a statement and an expression as particularly significant here, at least in terms of code clarity.


    https://perldoc.perl.org/perlsyn#Statement-Modifiers

    As for whether Python's conditional expression syntax, it's not
    clear
    that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else
    expr2) (unless you happen to be familiar with one of them).

    I think expr1 and expr2 belong naturally together, as you are
    selecting one or the other. If you are using a short-circuit
    evaluation, you would express it in words as "evaluate cond, and based
    on that, evaluate either expr1 and expr2". Having "expr1" first is a
    bit like a recipe that says "add the sugar to the egg whites, having
    first beaten the egg whites". It is an ordering that does not suit
    well in an imperative language (I know Python is multi-paradigm, but
    it is basically imperative).

    But I agree that familiarity could be a big factor in my subjective
    opinion here.

    I don't have a strong opinion one way or the other, beyond a willingness
    to accept the syntax and other rules of whatever language I'm using.

    Of course we use the languages we use, warts and all. It's rare that
    anyone uses a language for a significant amount of work and doesn't
    dislike at least some aspects of the language.

    But I suggest that Python's "expr1 if condition else expr2" is intended
    to emphasize expr1 over expr2, treating the condition being true as the "normal" case. That's not necessarily a bad thing.


    Perhaps.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 3 12:58:49 2024
    From Newsgroup: comp.lang.misc

    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 19:19, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 18:00, Keith Thompson wrote:
    David Brown <david.brown@hesbynett.no> writes:
    [...]
    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief >>>>> mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.
    No, Perl's conditional expressions use the same syntax as C's.

    I am not very familiar with Perl, and don't know what are expressions
    or statements. Perhaps I have been imagining things. I had the idea
    that in Perl you could write "<do_this> if <condition>" as an
    alternative to the more common imperative language ordering "if
    <condition> then <do_this>".
    Yes, but it's not the same thing. Perl has postfix conditionals, so
    you
    can write:
    statement if condition;
    but that's a statement, not an expression, and there's no form
    equivalent to if/else. It's a specific case of "statement modifiers",
    where the keyword can be any of if, unless, while, until, for, foreach,
    or when. (The latter is for an experimental "switch" feature, disabled
    by default in recent releases.)

    OK. That's a lot more than I knew.

    However, I don't see a relevant distinction between a statement and an expression as particularly significant here, at least in terms of code clarity.

    One distinction is that, for example, you can't use
    statement if condition;
    as part of a larger expression. Also, there's no else clause.

    Perl's statement modifiers are an alternative syntax for conditional *statements*. In particular, `statement if condition;` is equivalent to
    `if (condition) { statement; }`. Their purpose is to allow some code to
    be written more concisely. (Note that an if statement or other compound statement requires { and }.)

    Perl adopted C's ?: syntax for conditional expressions with little or
    no change.

    [...]
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Thu Apr 4 08:13:22 2024
    From Newsgroup: comp.lang.misc

    On Wed, 03 Apr 2024 17:16:31 +0100
    Richard Kettlewell <invalid@invalid.invalid> wrote:
    Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
    David Brown <david.brown@hesbynett.no> writes:
    On 03/04/2024 02:23, Lawrence D'Oliveiro wrote:
    It’s bloody horrible Python even when wrapped correctly. I think
    Python’s version of the conditional expression is a complete
    abortion.

    That's probably the reason almost no one uses it. That post is the
    first time I have ever seen conditional expressions outside of a brief
    mention in a tutorial on Python conditionals showing how to write
    normal conditionals in the language. I think Python stole this one
    from Perl.

    No, Perl's conditional expressions use the same syntax as C's.

    As for whether Python's conditional expression syntax, it's not clear
    that (cond ? expr1 : expr2) is better or worse than (expr1 if cond else
    expr2) (unless you happen to be familiar with one of them).

    I’ve been familiar with both for years and I think the Python version is >awful; in particular the ordering is a bizarre choice. The PEP where
    they worked out the design acknowledges this but then they went ahead
    and did it anyway...

    I believe its known as being different for the sake of being different which
    is closely related to change for changes sake. Its the reason screwed up the WIndows GUI - a new generation of devs had to prove their could be different
    to the previous one regardless of how badly their new version sucked. Or in more general cases - we've all seen new managers come in and change processes just to prove they were doing something.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Thu Apr 4 11:20:48 2024
    From Newsgroup: comp.lang.misc

    Richard Kettlewell <invalid@invalid.invalid> wrote or quoted:
    I’ve been familiar with both for years and I think the Python version is >awful; in particular the ordering is a bizarre choice.

    The way this syntax is set up is apparently credited to
    this guy named Guido, according to this PEP 308 thing.

    Now, in English, we usually throw a comma in there when an
    "if" clause comes first, 'cause it kinda throws off the normal
    flow, you know? So that shows the default position for "if"
    is actually after the main part. - Maybe Guido was making that
    same kind of comparison to English, and that's why he decided
    the post-"if" format works better.

    In my example here, there were a whole bunch of these operators
    all nested inside each other without any parentheses. And let
    me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation
    can start looking pretty darn mysterious to some folks.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Thu Apr 4 23:29:21 2024
    From Newsgroup: comp.lang.misc

    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation can start
    looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 09:17:37 2024
    From Newsgroup: comp.lang.misc

    On Thu, 4 Apr 2024 23:29:21 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation can start
    looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Just use brackets. Saves a lot of pain.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From candycanearter07@candycanearter07@candycanearter07.nomail.afraid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 12:40:02 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote at 09:17 this Friday (GMT):
    On Thu, 4 Apr 2024 23:29:21 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation can start
    looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Just use brackets. Saves a lot of pain.


    Or just use if blocks if it's too complex.
    --
    user <candycane> is generated from /dev/urandom
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 15:09:47 2024
    From Newsgroup: comp.lang.misc

    On Fri, 5 Apr 2024 12:40:02 -0000 (UTC)
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote: >Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote at 09:17 this Friday >(GMT):
    On Thu, 4 Apr 2024 23:29:21 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation can start
    looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Just use brackets. Saves a lot of pain.


    Or just use if blocks if it's too complex.

    Indeed. It might not look as "l33t", but with modern compilers it'll end
    up as the same assembler anyway.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 18:30:12 2024
    From Newsgroup: comp.lang.misc

    On 05.04.2024 01:29, Lawrence D'Oliveiro wrote:
    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation can start
    looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;


    Indentation generally helps. In above code (in my book) it's not
    that clear [from the indentation], e.g. where the last ':' 'else'
    belongs to. So I'd have lined the colons up with the respective
    '?'. (YMMV.)

    Not all languages differentiate (per syntax) a conditional command
    from a conditional expression. Here are the two forms supported by
    Algol for both, statements and expressions (here the examples are
    both depicted for expressions only)

    a :=
    ( b | ( c | d | e )
    | ( f | ( g | h | i )
    | j ) );

    The parenthesis are not used for grouping, but are the alternative
    form for IF/THEN/ELSE/FI

    a := IF b
    THEN
    IF c THEN d ELSE e FI
    ELSE
    IF f THEN
    IF g THEN h ELSE i FI
    ELSE j FI
    FI

    Pick your choice depending on the case (or taste).

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ram@ram@zedat.fu-berlin.de (Stefan Ram) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 17:37:52 2024
    From Newsgroup: comp.lang.misc

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote or quoted:
    On 05.04.2024 01:29, Lawrence D'Oliveiro wrote:
    This is where indentation helps. E.g.
    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Indentation generally helps.

    Let me give it a try to find how I would indent that!

    b?
    c? d: e:
    f?
    g? h: i:
    j;

    The parenthesis are not used for grouping, but are the alternative
    form for IF/THEN/ELSE/FI

    It's funny how the discussion oscillates between
    "too many parentheses" (LISP code) and "not enough parentheses"
    ("let me add some parens to improve readability").
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 20:47:40 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-05, Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
    On 05.04.2024 01:29, Lawrence D'Oliveiro wrote:
    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested
    stuff with not parentheses in view, even the "?:" notation can start
    looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;


    Indentation generally helps. In above code (in my book) it's not
    that clear [from the indentation], e.g. where the last ':' 'else'
    belongs to. So I'd have lined the colons up with the respective
    '?'. (YMMV.)

    Not all languages differentiate (per syntax) a conditional command
    from a conditional expression. Here are the two forms supported by
    Algol for both, statements and expressions (here the examples are
    both depicted for expressions only)

    a :=
    ( b | ( c | d | e )
    | ( f | ( g | h | i )
    | j ) );

    The parenthesis are not used for grouping, but are the alternative
    form for IF/THEN/ELSE/FI

    a := IF b
    THEN
    IF c THEN d ELSE e FI
    ELSE
    IF f THEN
    IF g THEN h ELSE i FI
    ELSE j FI
    FI

    Pick your choice depending on the case (or taste).


    #define XCAT(A, B) A ## B
    #define CAT(A, B) XCAT(A, B)

    #define IF(A, B, C) ((A) ? (B) : (C))

    #define COND_2(cond, then, ...) IF(cond, then, 0)
    #define COND_4(cond, then, ...) IF(cond, then, COND_2(__VA_ARGS__))
    #define COND_6(cond, then, ...) IF(cond, then, COND_4(__VA_ARGS__))
    #define COND_8(cond, then, ...) IF(cond, then, COND_6(__VA_ARGS__))

    #define COND_1(...) {syntax error}
    #define COND_3(...) {syntax error}
    #define COND_5(...) {syntax error}
    #define COND_7(...) {syntax error}

    #define COUNT_ARGS(...) COUNT_ARGS_IMPL(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1) #define COUNT_ARGS_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N

    #define COND(...) CAT(COND_, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)


    Now we can do:

    COND(b, ...,
    f, ...
    1, j)

    filling in the ...:

    COND(b, IF(c, d, e),
    f, IF(g, h, i),
    1, j)

    The GNU preprocessor gives me this:

    ((b) ? (((c) ? (d) : (e))) : (((f) ? (((g) ? (h) : (i))) : (((1) ? (j) : (0))))))

    which looks correct.

    The code is readable now, and importantly, my editor can format it. If I
    start adding line breaks, it's indented right. If I turn it into this:

    COND(b, IF(c, d, e),
    f, IF(g, h, i),
    1, j)

    then highlight it in Vim and hit =, it gets put back the way it was.

    If I add line breaks into the IFs, they get automatically indented
    right, just using Vim's support for basic C formatting of macro/function
    calls:

    cond(b, IF(c,
    d,
    e),
    f, IF(g,
    h,
    i),
    1, j)

    Compared to wrestling with five ways of formatting the the ill-conceived
    ?: syntax, it's a complete no brainer.

    Here is a version where the cond pairs have to be parenthesized.
    We can lose the even/odd argument count handling, and might as well
    extend to up to 8 clauses:

    #define IF(A, B, C) ((A) ? (B) : (C))

    #define XCAT(A, B) A ## B
    #define CAT(A, B) XCAT(A, B)

    #define COND_PAIR(pair, rest) IF(COND_COND pair, COND_THEN pair, rest)
    #define COND_COND(cond, then) cond
    #define COND_THEN(cond, then) then
    #define COND_1(pair, ...) COND_PAIR(pair, 0)
    #define COND_2(pair, ...) COND_PAIR(pair, COND_1(__VA_ARGS__))
    #define COND_3(pair, ...) COND_PAIR(pair, COND_2(__VA_ARGS__))
    #define COND_4(pair, ...) COND_PAIR(pair, COND_3(__VA_ARGS__))
    #define COND_5(pair, ...) COND_PAIR(pair, COND_4(__VA_ARGS__))
    #define COND_6(pair, ...) COND_PAIR(pair, COND_5(__VA_ARGS__))
    #define COND_7(pair, ...) COND_PAIR(pair, COND_6(__VA_ARGS__))
    #define COND_8(pair, ...) COND_PAIR(pair, COND_7(__VA_ARGS__))

    #define COUNT_ARGS(...) COUNT_ARGS_IMPL(__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1) #define COUNT_ARGS_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N

    #define COND(...) CAT(COND_, COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__)

    COND((b, IF(c,
    d,
    d)),
    (f, IF(g,
    h,
    i)),
    (1, j))

    The expansion is still

    ((b) ? (((c) ? (d) : (d))) : (((f) ? (((g) ? (h) : (i))) : (((1) ? (j) : (0))))))
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 23:08:52 2024
    From Newsgroup: comp.lang.misc

    On Fri, 5 Apr 2024 18:30:12 +0200, Janis Papanagnou wrote:

    Here are the two forms supported by Algol ...

    Just a note, that’s Algol 68. In my time, “Algol” used unqualified was understood to refer to Algol 60.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 23:11:54 2024
    From Newsgroup: comp.lang.misc

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:

    On Thu, 4 Apr 2024 23:29:21 -0000 (UTC) Lawrence D'Oliveiro
    <ldo@nz.invalid> wrote:

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    The improvement speaks for itself.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Alan Bawden@alan@csail.mit.edu to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 5 19:35:37 2024
    From Newsgroup: comp.lang.misc

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

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
    ...
    >> a =
    >> b ?
    >> c ? d : e
    >> : f ?
    >> g ? h : i
    >> : j;
    >
    > Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    A normal programmer would write something like:

    a = b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;

    I.e., she would allow herself to use spaces and newlines, and just
    enough parentheses to make the structure clear.

    - Alan
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 00:25:45 2024
    From Newsgroup: comp.lang.misc

    On Fri, 05 Apr 2024 19:35:37 -0400, Alan Bawden wrote:

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

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
    ...
    >> a =
    >> b ?
    >> c ? d : e
    >> : f ?
    >> g ? h : i
    >> : j;
    >
    > Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    A normal programmer would write something like:

    a = b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;

    I.e., she would allow herself to use spaces and newlines, and just
    enough parentheses to make the structure clear.

    It’s like, I don’t know ... you’re trying to save space. Why?

    It’s like programming inside an apartment block, instead of having a bungalow with a yard of your own.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 01:01:48 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-05, Alan Bawden <alan@csail.mit.edu> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
    ...
    >> a =
    >> b ?
    >> c ? d : e
    >> : f ?
    >> g ? h : i
    >> : j;
    >
    > Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    A normal programmer would write something like:

    a = b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;

    I.e., she would allow herself to use spaces and newlines, and just
    enough parentheses to make the structure clear.

    It looks good, undeniably.

    However, I cannot tell at a glance whether or not the nice appearance
    isn't telling me some kind of lie. That's an inherent problem with
    the ternary operator.

    I have to remember that = has lower precedence than ?:. But, ==
    has higher precedence. So this careless edit makes it wrong,
    even though it still looks just as nice:

    a == b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From candycanearter07@candycanearter07@candycanearter07.nomail.afraid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 01:10:05 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote at 15:09 this Friday (GMT):
    On Fri, 5 Apr 2024 12:40:02 -0000 (UTC)
    candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> wrote:
    Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote at 09:17 this Friday >>(GMT):
    On Thu, 4 Apr 2024 23:29:21 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On 4 Apr 2024 11:20:48 GMT, Stefan Ram wrote:

    And let me tell you, when you start getting into that kind of nested >>>>> stuff with not parentheses in view, even the "?:" notation can start >>>>> looking pretty darn mysterious to some folks.

    This is where indentation helps. E.g.

    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Just use brackets. Saves a lot of pain.


    Or just use if blocks if it's too complex.

    Indeed. It might not look as "l33t", but with modern compilers it'll end
    up as the same assembler anyway.


    Yeah. Not everything needs to be a hyper optimized single line
    statement.
    --
    user <candycane> is generated from /dev/urandom
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From candycanearter07@candycanearter07@candycanearter07.nomail.afraid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 01:10:06 2024
    From Newsgroup: comp.lang.misc

    Alan Bawden <alan@csail.mit.edu> wrote at 23:35 this Friday (GMT):
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
    ...
    >> a =
    >> b ?
    >> c ? d : e
    >> : f ?
    >> g ? h : i
    >> : j;
    >
    > Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    A normal programmer would write something like:

    a = b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;

    v (she?)
    I.e., she would allow herself to use spaces and newlines, and just
    enough parentheses to make the structure clear.

    - Alan


    Yeah, a bit of space for the code to breathe goes a long way.
    --
    user <candycane> is generated from /dev/urandom
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 08:58:45 2024
    From Newsgroup: comp.lang.misc

    On 5 Apr 2024 17:37:52 GMT
    ram@zedat.fu-berlin.de (Stefan Ram) wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote or quoted:
    On 05.04.2024 01:29, Lawrence D'Oliveiro wrote:
    This is where indentation helps. E.g.
    a =
    b ?
    c ? d : e
    : f ?
    g ? h : i
    : j;

    Indentation generally helps.

    Let me give it a try to find how I would indent that!

    b?
    c? d: e:
    f?
    g? h: i:
    j;

    The parenthesis are not used for grouping, but are the alternative
    form for IF/THEN/ELSE/FI

    It's funny how the discussion oscillates between
    "too many parentheses" (LISP code) and "not enough parentheses"
    ("let me add some parens to improve readability").

    Lisp overloads them as block markers which simply makes the code more confusing, not less.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 09:00:12 2024
    From Newsgroup: comp.lang.misc

    On Fri, 05 Apr 2024 19:35:37 -0400
    Alan Bawden <alan@csail.mit.edu> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
    ...
    >> a =
    >> b ?
    >> c ? d : e
    >> : f ?
    >> g ? h : i
    >> : j;
    >
    > Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    A normal programmer would write something like:

    a = b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;

    I.e., she would allow herself to use spaces and newlines, and just

    ITYM "he" would allow HIMself.

    Lets give the woke BS a miss, 95% of developers are men. It doesn't give you any brownie points, just makes you look a try-hard ass.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 15:44:13 2024
    From Newsgroup: comp.lang.misc

    On 06/04/2024 03:01, Kaz Kylheku wrote:
    On 2024-04-05, Alan Bawden <alan@csail.mit.edu> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    On Fri, 5 Apr 2024 09:17:37 -0000 (UTC), Muttley wrote:
    ...
    >> a =
    >> b ?
    >> c ? d : e
    >> : f ?
    >> g ? h : i
    >> : j;
    >
    > Just use brackets. Saves a lot of pain.

    a=(b?(c?d:e):(f?(g?h:i):j));

    A normal programmer would write something like:

    a = b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;

    I.e., she would allow herself to use spaces and newlines, and just
    enough parentheses to make the structure clear.

    It looks good, undeniably.

    However, I cannot tell at a glance whether or not the nice appearance
    isn't telling me some kind of lie. That's an inherent problem with
    the ternary operator.

    That's a key point - and it is not just with the ternary operator, but a general issue. Good spacing, indentation, newlines and layout make code easier to read. But it is vital that there is never any doubt that the
    layout matches the meaning of the code. If not, then you might be sure
    what the programmer meant dues to the layout, but you are not sure that
    the compiler sees it the same way. After all, this looks neat and clear
    too :

    a =
    b & c +
    d & e +
    f & g

    But the language viewpoint (assuming it is in C, or a language with
    similar precedences) and the code appearance are very different.

    Parentheses help, until there are too many to be easily tracked by the
    reader. Splitting the expression into parts, adding new local
    variables, using separate statements, making new helper functions -
    these are all ways to improve the code, and have no efficiency cost with modern tools.

    A lot of people think the layout of code should make the programmer's intentions clear, and make it easy to see what the code does. That's
    true, but it is not enough. Code layout should also make it easy to see
    that the code does what the programmer intended. It should be easy for
    a maintainer to modify it without introducing errors. It should also be
    hard for a reader to misinterpret it (which is not the same as saying it should be easy to interpret correctly). It should be hard for a
    maintainer to make mistakes. It should be easy to spot any mistakes
    that get made.



    I have to remember that = has lower precedence than ?:. But, ==
    has higher precedence. So this careless edit makes it wrong,
    even though it still looks just as nice:

    a == b ? (c ? d : e) :
    f ? (g ? h : i) :
    j;


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 15:03:57 2024
    From Newsgroup: comp.lang.misc

    On Sat, 6 Apr 2024 15:44:13 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    A lot of people think the layout of code should make the programmer's >intentions clear, and make it easy to see what the code does. That's

    Unfortunately IME another lot (usually young) seem to think that the more complicated their make their code the more it will impress their peers and/or boss. This seems to be a particular problem with C++ as its current overspecced and overcomplicated syntax allows you to write code that would make a Perl dev envious.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 18:49:38 2024
    From Newsgroup: comp.lang.misc

    On 05.04.2024 19:37, Stefan Ram wrote:
    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote or quoted:

    [ Algol syntax variants, keywords vs. parenthesis ("meek form" ?) ]

    The parenthesis are not used for grouping, but are the alternative
    form for IF/THEN/ELSE/FI

    It's funny how the discussion oscillates between
    "too many parentheses" (LISP code) and "not enough parentheses"
    ("let me add some parens to improve readability").

    We should distinguish the various aspects posted over time.
    Parenthesis used...
    - to group sub-expressions (to make precedence clear or
    fix some precedence inconsistency in the language)
    => that's IMO a Good Thing for non-trivial cases
    - as necessary syntax of the language (like inherently
    in Lisp, or in C's control structures)
    => I don't like them, but you have no choice here
    (but changing the language, where/if possible)
    - as an alternative syntactic form of conditionals
    (as in Algol, where you can choose the syntax)
    => Personally I like the verbose keywords, but in
    case of conditional expressions the concise form
    with parenthesis might be better readable (though
    this can be different in complex cases as posted)
    Note that in Algol not only the 'IF's can be written
    in that parenthesis syntax form, you can also use
    the '(' and ')' instead of the 'BEGIN'/'END' keywords.

    It boils down to: to each his own, and, use what's most
    appropriate depending on context.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 18:57:47 2024
    From Newsgroup: comp.lang.misc

    On 06.04.2024 01:08, Lawrence D'Oliveiro wrote:
    On Fri, 5 Apr 2024 18:30:12 +0200, Janis Papanagnou wrote:

    Here are the two forms supported by Algol ...

    Just a note, that’s Algol 68. In my time, “Algol” used unqualified was understood to refer to Algol 60.

    This seems to have been the case before Algol 68 appeared.
    (I'm not sure this matches with what you call "in my time".)

    I named it always explicitly as "Algol 60" and "Algol 68".
    But at some instance of time I read somewhere that "Algol"
    would "now" refer to Algol 68, so I changed my habit.

    But since your post shows that this may not (not yet?) be
    common usage I'll be more specific in future. - Thanks for
    the hint!

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andy Walker@anw@cuboid.co.uk to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 19:32:14 2024
    From Newsgroup: comp.lang.misc

    On 06/04/2024 17:57, Janis Papanagnou wrote:
    I named it always explicitly as "Algol 60" and "Algol 68".
    But at some instance of time I read somewhere that "Algol"
    would "now" refer to Algol 68, so I changed my habit.

    Quite right. Algol 60 died, for all practical purposes,
    half a century ago. Algol 68 may be a niche interest, but it is
    still a nice language, and its [dwindling] band of adherents and
    practitioners still use it and prefer it to C and other more
    recent languages.

    But since [LD'O's] post shows that this may not (not yet?) be
    common usage I'll be more specific in future. - Thanks for
    the hint!

    For how long? Does anyone still think that an unadorned
    "Unix" must refer to 6th Edition [or earlier], "C" to K&R, "Fortran"
    to Fortran IV, and so on? Clearly, there /are/ occasions when it is
    necessary to specify which version of a language/OS/computer/... is
    being referred to, and there is often a change-over period of a few
    years when an older version is still sufficiently current. But fifty
    years is surely long enough to get used to the newer version!
    --
    Andy Walker, Nottingham.
    Andy's music pages: www.cuboid.me.uk/andy/Music
    Composer of the day: www.cuboid.me.uk/andy/Music/Composers/Godfrey
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 23:54:50 2024
    From Newsgroup: comp.lang.misc

    On 06.04.2024 20:32, Andy Walker wrote:
    On 06/04/2024 17:57, Janis Papanagnou wrote:
    I named it always explicitly as "Algol 60" and "Algol 68".
    But at some instance of time I read somewhere that "Algol"
    would "now" refer to Algol 68, so I changed my habit.

    Quite right. Algol 60 died, for all practical purposes,
    half a century ago. Algol 68 may be a niche interest, but it is
    still a nice language, and its [dwindling] band of adherents and practitioners still use it and prefer it to C and other more
    recent languages.

    I think it's a not only formally outstanding language; despite I've
    never used it professionally since my first contact with it in the
    early 1980's. (Though I still have a compiler on my private box to
    play with it.)


    But since [LD'O's] post shows that this may not (not yet?) be
    common usage I'll be more specific in future. - Thanks for
    the hint!

    For how long? Does anyone still think that an unadorned
    "Unix" must refer to 6th Edition [or earlier], "C" to K&R, "Fortran"
    to Fortran IV, and so on? Clearly, there /are/ occasions when it is necessary to specify which version of a language/OS/computer/... is
    being referred to, and there is often a change-over period of a few
    years when an older version is still sufficiently current. But fifty
    years is surely long enough to get used to the newer version!

    Yes. - What I didn't know was whether that generic "Algol" naming
    convention was already made around 1968 or maybe only much later.

    But, WRT Algol 60 vs. Algol 68, these are quite different languages;
    I wouldn't call the latter a new version. While some basic abstract
    concepts from Algol 60 have certainly been considered in Algol 68
    the whole design and specification process was done anew in Algol 68.
    (The van Wijngaarden grammar also was some fundamental new approach.)
    These languages can hardly be seen as "versions" of the same language.

    Algol 60, OTOH, also had an own history and continued use after 1968;
    to my knowledge it had been used in numerical mathematics and it was
    (while per se quite terse a language) the base of Simula 67, an
    extremely powerful language ahead of time (still).

    But Algol 60, Simula, and also Algol 68 are all meaningless today, I
    (sadly) dare to say. Maybe more than of "niche interest"? Can't tell.
    Back these days they certainly were not hyped (as languages nowadays
    are as part of the inventor's "marketing" activities). There's papers
    existing that try to explain the/possible reasons for their fail to
    become established.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 15:07:04 2024
    From Newsgroup: comp.lang.misc

    Andy Walker <anw@cuboid.co.uk> writes:
    On 06/04/2024 17:57, Janis Papanagnou wrote:
    I named it always explicitly as "Algol 60" and "Algol 68".
    But at some instance of time I read somewhere that "Algol"
    would "now" refer to Algol 68, so I changed my habit.

    That doesn't match my experience.

    Quite right. Algol 60 died, for all practical purposes,
    half a century ago. Algol 68 may be a niche interest, but it is
    still a nice language, and its [dwindling] band of adherents and practitioners still use it and prefer it to C and other more
    recent languages.

    I've never heard "Algol" by itself used to refer to Algol 68, which had
    enough changes to be essentially a different language, and one which
    didn't really replace Algol 60 (though it was clearly intended to).

    <https://en.wikipedia.org/wiki/ALGOL> agrees.

    The relative popularity of Algol 60 vs. 68 doesn't necessarily change
    what "Algol" means.

    [...]
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 22:57:13 2024
    From Newsgroup: comp.lang.misc

    On Sat, 6 Apr 2024 18:57:47 +0200, Janis Papanagnou wrote:

    I named it always explicitly as "Algol 60" and "Algol 68". But at some instance of time I read somewhere that "Algol" would "now" refer to
    Algol 68, so I changed my habit.

    Sure, Algol 60 is way beyond a museum piece by now. But remember, that was
    the one that spawned a great number of offshoots, namely the “Algol-like” language family--or really, superfamily. That included Pascal and its own offshoots.

    Algol 68 was a bit less influential in terms of language features (I think
    C “int”, “char”, “struct” and “union”, and the “long” and “short”
    qualifiers came from there, and csh “if ... fi” as well), but it did seem to introduce a bunch of new terminology, some of which caught on, others
    did not. See how many you can spot:

    * “Elaboration” for the process of executing a program (including possibly
    transforming from source form to an executable form)
    * “Transput” instead of “input/output”
    * “Heap” for an area in which memory may be dynamically allocated and
    freed in no particular order
    * “Overloading” for multiple context-dependent definitions of an operator
    * “Name” instead of “pointer” or “address”
    * “Mode” instead of “data type”
    * “Coercion” for a type conversion
    * “Cast” for an explicit type conversion
    * “Void” for a construct yielding no value
    * “Dereferencing” for following a pointer
    * “Slice” for a subarray of an array
    * “Pragmat” for compiler directive (I think “pragma” is more common
    nowadays.)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 01:31:59 2024
    From Newsgroup: comp.lang.misc

    On 07.04.2024 00:57, Lawrence D'Oliveiro wrote:

    Sure, Algol 60 is way beyond a museum piece by now. But remember, that was the one that spawned a great number of offshoots, namely the “Algol-like”
    language family--or really, superfamily. That included Pascal and its own offshoots.

    Indeed, it became the base of a huge tree of important programming
    languages.


    Algol 68 was a bit less influential in terms of language features

    I like it more for its formal coherence than for specific features.

    But of course it also has a lot of features; besides some mentioned
    in your post, e.g., the generalized 'for' loop (that can even be
    abbreviated for control structure subsets), but that we also find
    (even in a more generalized version) already in Simula 67, BTW.

    (I think
    C “int”, “char”, “struct” and “union”, and the “long” and “short”
    qualifiers came from there, and csh “if ... fi” as well), [...]

    It was more a base for the Bourne shell family (and its successors,
    including POSIX shell through ksh88). But yes, it influenced quite
    some languages. And, yes, it was less influential than Algol 60.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 01:47:13 2024
    From Newsgroup: comp.lang.misc

    On 07.04.2024 00:57, Lawrence D'Oliveiro wrote:

    Algol 68 was a bit less influential in terms of language features [...]
    See how many you can spot:

    * “Elaboration” for the process of executing a program (including possibly
    transforming from source form to an executable form)
    * “Transput” instead of “input/output”

    After all these decades it sounds still strange in my ears.

    * “Heap” for an area in which memory may be dynamically allocated and
    freed in no particular order
    * “Overloading” for multiple context-dependent definitions of an operator * “Name” instead of “pointer” or “address”

    Well, we had function parameters called "by name" before.

    And we have 'REF' for references. (Also seen in Simula 67.)

    * “Mode” instead of “data type”
    * “Coercion” for a type conversion
    * “Cast” for an explicit type conversion
    * “Void” for a construct yielding no value

    This is an interesting thing in Algol 68 if you study the
    details!

    As the "type" of statements it makes function definitions
    or the mentioned conditionals (statements and expressions)
    a coherent concept.

    * “Dereferencing” for following a pointer
    * “Slice” for a subarray of an array
    * “Pragmat” for compiler directive (I think “pragma” is more common
    nowadays.)

    And maybe printf() and the op:= set of operators, and more.

    I also find its collateral abilities very interesting. But I
    seem to recall that not every compiler supports that.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 23:49:30 2024
    From Newsgroup: comp.lang.misc

    On Sat, 6 Apr 2024 08:58:45 -0000 (UTC), Muttley wrote:

    Lisp overloads them as block markers which simply makes the code more confusing, not less.

    That’s because there is no fundamental difference between “blocks” and whatever else it is you think those Lisp parentheses are used for.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 23:57:39 2024
    From Newsgroup: comp.lang.misc

    On Sun, 7 Apr 2024 01:47:13 +0200, Janis Papanagnou wrote:

    On 07.04.2024 00:57, Lawrence D'Oliveiro wrote:

    * “Name” instead of “pointer” or “address”

    Well, we had function parameters called "by name" before.

    Those were actually “thunks”. An early draft Algol 68 spec kept them on in the form of “proceduring” coercions, but these were dropped in the revised report.

    See also <https://en.wikipedia.org/wiki/Jensen%27s_device>.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Javier@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 00:01:43 2024
    From Newsgroup: comp.lang.misc

    In comp.unix.shell Johanne Fairchild <jfairchild@tudado.org> wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:

    At one time, we distinguished between “scripting” languages and
    “programming” languages. [...] But there is one distinction that I
    think is still relevant, and that is the one between shell/command
    languages and programming languages.

    [...]

    Consider looking at a shell language like a domain-specific programming language. A shell is a programming language made specifically for
    running programs. When you write a shell line, you're specifying the arguments of execve(2). In other words, a shell is a programming
    language made to prepare the memory to be consumed by the system in a specific way---execve(2).

    It certainly encourages the writing of small modular tools. The
    downside is the loss of performance because of disk access for trivial
    things like 'nfiles=$(ls | wc -l)'. I suspect disk access times where
    one of the reasons for the development of perl in the early 90s.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 02:02:15 2024
    From Newsgroup: comp.lang.misc

    On Sun, 07 Apr 2024 00:01:43 +0000, Javier wrote:

    The downside is the loss of performance because of disk access for
    trivial things like 'nfiles=$(ls | wc -l)'.

    Well, you could save one process creation by writing
    “nfiles=$(echo * | wc -l)” instead. But that would still not be strictly correct.

    I suspect disk access times where
    one of the reasons for the development of perl in the early 90s.

    Shells were somewhat less powerful in those days. I would describe the
    genesis of Perl as “awk on steroids”. Its big party trick was regular expressions. And I guess combining that with more sophisticated data- structuring capabilities.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 20:41:06 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    [...]
    Sure, Algol 60 is way beyond a museum piece by now. But remember, that was the one that spawned a great number of offshoots, namely the “Algol-like”
    language family--or really, superfamily. That included Pascal and its own offshoots.

    Algol 68 was a bit less influential in terms of language features (I think
    C “int”, “char”, “struct” and “union”, and the “long” and “short”
    qualifiers came from there, and csh “if ... fi” as well), but it did seem
    to introduce a bunch of new terminology, some of which caught on, others
    did not. See how many you can spot:

    csh uses "if ... then ... endif". Bourne shell uses "if ... fi" (and
    "case ... esac").

    * “Elaboration” for the process of executing a program (including possibly
    transforming from source form to an executable form)

    In Ada, statements are "executed", expressions are "evaluated", and declarations are "elaborated".

    [...]
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 6 20:46:59 2024
    From Newsgroup: comp.lang.misc

    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Sun, 07 Apr 2024 00:01:43 +0000, Javier wrote:

    The downside is the loss of performance because of disk access for
    trivial things like 'nfiles=$(ls | wc -l)'.

    Well, you could save one process creation by writing
    “nfiles=$(echo * | wc -l)” instead. But that would still not be strictly correct.

    If that saves a process, it's because echo is builtin. But it will set
    $nfiles to 1 (unless you happen to have files with newlines in their
    names). Both skip hidden files, which may or may not be what you want.

    [...]
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Alan Bawden@alan@csail.mit.edu to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 06:04:16 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:

    On Fri, 05 Apr 2024 19:35:37 -0400
    Alan Bawden <alan@csail.mit.edu> wrote:
    ...
    >I.e., she would allow herself to use spaces and newlines, and just

    ITYM "he" would allow HIMself.

    My practice when I am writing and I need a generic pronoun is to flip a
    coin to decide whether I am going to use "she" or "he". On this
    occasion the coin determined that I was going to write "she".

    I started doing this many years ago after some author, in his book's introduction, offered as a defense of using exclusively male pronouns in
    the rest of his book the fact that he had just used female pronouns in
    the previous paragraph, and "the reader will have found this jarring".
    Well I hadn't actually noticed that he had done that, and I had to go
    back and check to be sure he had.

    The book in question was a couple decades old at that time, so I took my failure to notice what the author thought I would find jarring as
    evidence that the language had evolved to the point where a occasional
    generic "she" would not offend a reasonable reader. So for years I've
    used "she" about 50% of the time, and nobody has _ever_ objected.

    Until today...

    Lets give the woke BS a miss, 95% of developers are men. It doesn't
    give you any brownie points, just makes you look a try-hard ass.

    It doesn't matter to me what percentage of developers are male. As long
    as there are _some_ female developers, it is possible that the developer
    in a hypothetical situation might be female, so it seems fair to
    occasionally use "she".

    If acknowledging the existence of female developers makes you
    uncomfortable, you're just going to have to learn to deal with that
    yourself. I'm not going to adjust my language to cater to your
    insecurities.

    - Alan
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andy Walker@anw@cuboid.co.uk to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 14:43:04 2024
    From Newsgroup: comp.lang.misc

    On 06/04/2024 22:54, Janis Papanagnou wrote:
    But, WRT Algol 60 vs. Algol 68, these are quite different languages;
    I wouldn't call the latter a new version.

    I agree; OTOH, WG2.1 accepted A68 as the "new" Algol. The
    instant question here was what an unadorned "Algol" means, and while
    I can see an argument for saying that it shouldn't happen, I can see
    no argument for saying that it, by default, refers to A60.

    [...]
    Algol 60, OTOH, also had an own history and continued use after 1968;
    to my knowledge it had been used in numerical mathematics [...].

    It was intended for use in the /description/ of NA, for which
    it was decently suitable. But it was unsuitable as a practical language
    for use in NA: no proper error control, no double-length numbers, no
    array slices, and doubtless other things I've forgotten. So you could
    say "Here is my new whizzo algorithm for [whatever]", get it published,
    and "everyone" would understand what your code meant. But in practice
    you would transcribe it into Fortran or some Autocode, typically twice
    as fast and with much better practical facilities.

    But Algol 60, Simula, and also Algol 68 are all meaningless today, I
    (sadly) dare to say.

    You're probably right. But A68G is still a nice language. It
    creaks in places, and it's not suitable for everything [what is?]. But
    it serves all my programming needs. It has the advantage, in practice,
    over C that all the common programming blunders -- use of uninitialised variables, array accesses out of bounds, numerical overflow, dereferencing
    null pointers, memory leaks and consequences thereof, the things that
    cause most of the security holes -- are picked up either by the compiler
    or at run-time before they can do any damage. I expect there are modern languages that also do that, but at my age it's not worth learning a new language when the old one works perfectly well.
    --
    Andy Walker, Nottingham.
    Andy's music pages: www.cuboid.me.uk/andy/Music
    Composer of the day: www.cuboid.me.uk/andy/Music/Composers/Haydn
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 15:47:18 2024
    From Newsgroup: comp.lang.misc

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 06.04.2024 20:32, Andy Walker wrote:


    But Algol 60, Simula, and also Algol 68 are all meaningless today, I
    (sadly) dare to say. Maybe more than of "niche interest"? Can't tell.

    There is still some small amount of new Algol code being developed
    and likely quite a bit in production in Unisys Clearpath shops.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 21:05:54 2024
    From Newsgroup: comp.lang.misc

    On Sun, 7 Apr 2024 14:43:04 +0100, Andy Walker wrote:

    I can see no argument for saying that [“Algol”], by default, refers to A60.

    “Wirth-Hoare Algol”, a.k.a. “Algol-W” (the precursor of Pascal) was a derivative of Algol-60, not Algol-68 (which didn’t exist yet).

    “Burroughs Algol” was an implementation of Algol-60, not Algol-68.

    Even in the 21st century, articles like <https://seattlewebsitedevelopers.medium.com/algol-the-language-that-influenced-the-future-cfec9a3e2a4c>
    can say

    Generally called ALGOL 60, ALGOL had three major updates ...
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sun Apr 7 14:45:23 2024
    From Newsgroup: comp.lang.misc

    Andy Walker <anw@cuboid.co.uk> writes:
    On 06/04/2024 22:54, Janis Papanagnou wrote:
    But, WRT Algol 60 vs. Algol 68, these are quite different languages;
    I wouldn't call the latter a new version.

    I agree; OTOH, WG2.1 accepted A68 as the "new" Algol. The
    instant question here was what an unadorned "Algol" means, and while
    I can see an argument for saying that it shouldn't happen, I can see
    no argument for saying that it, by default, refers to A60.

    The question is not which language "Algol" *should* refer to. Or
    rather, that's a different question. The question is which language
    "Algol" refers to in real-world common usage. In my (obviously not
    universal) experience, "Algol" by itself never means Algol 68; it always
    means Algol 60.

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

    ALGOL 68 is substantially different from ALGOL 60 and was not well
    received,[according to whom?] so reference to "Algol" is generally
    understood to mean ALGOL 60 and its dialects.[citation needed]

    Since this confusion obviously exists, I suggest referring to "Algol 60"
    and "Algol 68" explicitly.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 07:44:27 2024
    From Newsgroup: comp.lang.misc

    On Sat, 6 Apr 2024 23:49:30 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Sat, 6 Apr 2024 08:58:45 -0000 (UTC), Muttley wrote:

    Lisp overloads them as block markers which simply makes the code more
    confusing, not less.

    That’s because there is no fundamental difference between “blocks” and >whatever else it is you think those Lisp parentheses are used for.

    Hmm, wonder why hardly anyone outside academia used the language even back in the day, never mind now....

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 07:47:05 2024
    From Newsgroup: comp.lang.misc

    On Sun, 07 Apr 2024 06:04:16 -0400
    Alan Bawden <alan@csail.mit.edu> wrote:
    If acknowledging the existence of female developers makes you
    uncomfortable, you're just going to have to learn to deal with that
    yourself. I'm not going to adjust my language to cater to your
    insecurities.

    If my insecurities you mean acknowledging reality then fine. The thing about people like you is (and I don't believe the 50% thing, sorry) is that you
    would never use a male pronoun if talking about nurses or pre school teachers who are heavily biased towards women.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 14:11:44 2024
    From Newsgroup: comp.lang.misc

    On 07.04.2024 15:43, Andy Walker wrote:

    I agree; OTOH, WG2.1 accepted A68 as the "new" Algol. The
    instant question here was what an unadorned "Algol" means, and while
    I can see an argument for saying that it shouldn't happen, I can see
    no argument for saying that it, by default, refers to A60.

    Well, after that other post I decided to explicitly differentiate them
    per year suffix to not confuse anyone. That's okay for me. (OTOH I just
    notice that I missed to identify "Simula" as "Simula 67"; there's also
    "Simula I". But in case of Simula it's anyway more of a version.[*])


    But Algol 60, Simula, and also Algol 68 are all meaningless today, I
    (sadly) dare to say.

    You're probably right. But A68G is still a nice language. It
    creaks in places, and it's not suitable for everything [what is?]. But
    it serves all my programming needs. It has the advantage, in practice,
    over C that all the common programming blunders -- use of uninitialised variables, array accesses out of bounds, numerical overflow, dereferencing null pointers, memory leaks and consequences thereof, the things that
    cause most of the security holes -- are picked up either by the compiler
    or at run-time before they can do any damage. I expect there are modern languages that also do that, but at my age it's not worth learning a new language when the old one works perfectly well.

    Yes, indeed.

    Janis

    [*] Nice fact, BTW, that you can compile (almost all) Algol 60
    programs with Simula 67 - Algol 60 is [mostly] a subset - but not
    with Algol 68, which is a different language.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 14:35:48 2024
    From Newsgroup: comp.lang.misc

    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    On Sun, 07 Apr 2024 06:04:16 -0400
    Alan Bawden <alan@csail.mit.edu> wrote:
    If acknowledging the existence of female developers makes you
    uncomfortable, you're just going to have to learn to deal with that
    yourself. I'm not going to adjust my language to cater to your
    insecurities.

    If my insecurities you mean acknowledging reality then fine. The thing about people like you is (and I don't believe the 50% thing, sorry) is that you would never use a male pronoun if talking about nurses or pre school teachers who are heavily biased towards women.


    What makes you so sure about that? Are you assuming that because /you/
    are sexist, everyone else is?

    It is a fact that some professions have a heavy gender bias. Yes, most programmers are male, and most nurses are female. It is even reasonable
    to say that for some tasks there are statistically relevant biological differences that justify a bias (in the same way that you can say men
    are, on average, taller than women, even though some women are taller
    than some men).

    But is it a good thing that there is such gender bias? Usually not - it
    is usually best to have a mix in all practical ways (genders, race, nationality, age, etc.).

    Being inclusive in the language used is not likely to make a big dent in attracting people from poorly represented groups in a particular field -
    but using non-inclusive language does make a difference in chasing away
    those that venture in. Worst of all is people like you who actively say
    that women programmers are so abnormal we should ignore the possibility
    of their existence!

    Some people write "he/she". Some people alternate gender pronouns, or
    pick randomly. Some people use "they", or try to avoid using pronouns
    at all in their wording. These are all fine. It is also entirely understandable that some people just write "he" because they don't think
    about it at all. But I can't understand the mentality of someone who
    actively tries to work against inclusive language. We are not talking
    about some kind of quota system that you might feel is unfair, or even requiring you to change /your/ language - we are talking about someone
    who used "she" in reference to "a normal programmer", and that has got
    you throwing a fit.

    And for the record, I would use he/she/they for nurses or pre-school
    teachers if I did not know the gender of the individual.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 14:53:09 2024
    From Newsgroup: comp.lang.misc

    On 07.04.2024 23:05, Lawrence D'Oliveiro wrote:

    Even in the 21st century, articles like <https://seattlewebsitedevelopers.medium.com/algol-the-language-that-influenced-the-future-cfec9a3e2a4c>
    can say

    Generally called ALGOL 60, ALGOL had three major updates ...

    An extremely badly written article in *all* aspects (form, content,
    facts, quality, etc.). Not worth reading (I've just read it).
    And thus even less useful as sort of "reference" to any argument.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 14:33:25 2024
    From Newsgroup: comp.lang.misc

    On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    On Sun, 07 Apr 2024 06:04:16 -0400
    Alan Bawden <alan@csail.mit.edu> wrote:
    If acknowledging the existence of female developers makes you
    uncomfortable, you're just going to have to learn to deal with that
    yourself. I'm not going to adjust my language to cater to your
    insecurities.

    If my insecurities you mean acknowledging reality then fine. The thing about >> people like you is (and I don't believe the 50% thing, sorry) is that you
    would never use a male pronoun if talking about nurses or pre school teachers

    who are heavily biased towards women.


    What makes you so sure about that? Are you assuming that because /you/
    are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever
    straw men follow.

    tl;dr, bugger off.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 07:55:47 2024
    From Newsgroup: comp.lang.misc

    On Sun, 07 Apr 2024 00:01:43 +0000
    Javier <invalid@invalid.invalid> wrote:

    It certainly encourages the writing of small modular tools. The
    downside is the loss of performance because of disk access for trivial
    things like 'nfiles=$(ls | wc -l)'. I suspect disk access times where
    one of the reasons for the development of perl in the early 90s.

    You really want either built-ins for a lot of basic commands, or a good
    scheme for caching commonly-used executables. AmigaDOS (a TriPOS
    derivative) made it pretty trivial to set up a RAM disk and add that to
    the search path, which made a big difference in performance since
    almost nothing was built-in. Wouldn't be hard to do in *nix-land,
    either, but it's an open question whether you'd gain anything over
    modern generalized disk caching.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 08:20:37 2024
    From Newsgroup: comp.lang.misc

    On Sat, 6 Apr 2024 00:25:45 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    It’s like, I don’t know ... you’re trying to save space. Why?

    It’s like programming inside an apartment block, instead of having a bungalow with a yard of your own.
    It's a matter of balance. Needlessly crunching things to fit onto a
    single line is hard to read, yes - but compulsively indenting and
    splitting across lines can get out of hand, too. It seems to me that a
    lot of people in this age of "cinematic" aspect ratios and super-sized
    displays in personal computing forget that eye-travel isn't free, and
    spreading information across maximal space can make it *harder* to keep
    track of context.
    Better, IMHO, to group operations in a way that logically reflects the structure of the program, to whatever extent that *A.* is syntactically feasible in $LANGUAGE, and *B.* doesn't crowd things to the point of
    hampering basic readability.
    (Of course, whether or not the ternary operator is fundamentally
    confusing is an entirely separate question.)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Javier@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 17:54:42 2024
    From Newsgroup: comp.lang.misc

    In comp.unix.shell John Ames <commodorejohn@gmail.com> wrote:
    On Sun, 07 Apr 2024 00:01:43 +0000
    Javier <invalid@invalid.invalid> wrote:

    the loss of performance because of disk access for trivial
    things like 'nfiles=$(ls | wc -l)'. I suspect disk access times where
    one of the reasons for the development of perl in the early 90s.

    You really want either built-ins for a lot of basic commands, or a good scheme for caching commonly-used executables. AmigaDOS (a TriPOS
    derivative) made it pretty trivial to set up a RAM disk and add that to
    the search path, which made a big difference in performance since
    almost nothing was built-in. Wouldn't be hard to do in *nix-land,
    either, but it's an open question whether you'd gain anything over
    modern generalized disk caching.

    I don't worry about that anymore. My bash scripts run blazing fast
    in my laptop with an SSD. I guess it was an issue at the time Perl
    appeared (1987), although TBH I didn't experience it myself, since at
    that time I wasn't a Unix user.

    Also, I suspect HD caching and the increase in HD speed was one of the
    reasons for the fall in popularity of Perl for writing small system
    automation tasks that could be done with just shell. But there were
    another reasons, like the disapearance of diversity in the Unix OS ecosystem. Perl made easy to write portable scripts that could run on propietary Unixen that came with slight incompatibilities in the command line tools (IRIX/Solaris/HP-UX/AIX, etc.)

    Perhaps somebody here who uses (or used to use) Perl for system
    automation tasks can tell us more about their personal reasons
    for prefering (or used to prefer) Perl over shell.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 19:32:21 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-08, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    On Sun, 07 Apr 2024 06:04:16 -0400
    Alan Bawden <alan@csail.mit.edu> wrote:
    If acknowledging the existence of female developers makes you
    uncomfortable, you're just going to have to learn to deal with that
    yourself. I'm not going to adjust my language to cater to your
    insecurities.

    If my insecurities you mean acknowledging reality then fine. The thing about
    people like you is (and I don't believe the 50% thing, sorry) is that you >>> would never use a male pronoun if talking about nurses or pre school teachers

    who are heavily biased towards women.


    What makes you so sure about that? Are you assuming that because /you/ >>are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever straw men follow.

    You wrote, "people like you ... would never use a male pronoun if
    talking about nurses", written by you, is already ad hominem;
    it's a direct accusation of hypocrisy, rather than focusing on the
    argument content.

    If you can't handle the ad-hominem ball returned to your court,
    don't serve it!
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 22:14:16 2024
    From Newsgroup: comp.lang.misc

    On Mon, 8 Apr 2024 08:20:37 -0700, John Ames wrote:

    ... compulsively indenting and
    splitting across lines can get out of hand, too. It seems to me that a
    lot of people in this age of "cinematic" aspect ratios and super-sized displays in personal computing forget that eye-travel isn't free, and spreading information across maximal space can make it *harder* to keep
    track of context.

    There it is again: “maximal space”. The “space” is there to be used. Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure
    clearer?

    Another example:

    def fill_in_depreciations(tax_year) :
    "(re)inserts depreciation entries for the specified tax year," \
    " based on currently-entered assets."
    sql.cursor.execute \
    (
    "delete from payments where kind = %s and tax_year = %s",
    ["D", tax_year]
    )
    for \
    entry \
    in \
    get_each_record \
    (
    table_name = "assets, asset_depreciations",
    fields =
    [
    "assets.description as description",
    "assets.initial_value as initial_value",
    "assets.when_purchased as when_purchased",
    "assets.depreciation_rate as rate",
    "assets.depreciation_method as method",
    "asset_depreciations.depreciation_amount as amount",
    ],
    condition =
    "assets.asset_id = asset_depreciations.asset_id and"
    " asset_depreciations.tax_year = %s",
    values = [tax_year]
    ) \
    :
    sql.cursor.execute \
    (
    "insert into payments set when_made = %(when_made)s,"
    " description = %(description)s, other_party_name = \"\","
    " amount = %(amount)d, kind = \"D\", tax_year = %(tax_year)d"
    %
    {
    "when_made" : end_for_tax_year(tax_year) - 1,
    "description" :
    sql_string
    (
    "%s: %s $%s at %d%% from %s"
    %
    (
    entry["description"],
    entry["method"],
    format_amount(entry["initial_value"]),
    entry["rate"],
    format_date(entry["when_purchased"]),
    )
    ),
    "amount" : - entry["amount"],
    "tax_year" : tax_year,
    }
    )
    #end for
    #end fill_in_depreciations
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 22:16:08 2024
    From Newsgroup: comp.lang.misc

    On Mon, 8 Apr 2024 07:44:27 -0000 (UTC), Muttley wrote:

    Hmm, wonder why hardly anyone outside academia used the language even back in
    the day, never mind now....

    *cough* AutoCAD *cough*

    (Even if they did end up doing it wrong.)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 22:21:29 2024
    From Newsgroup: comp.lang.misc

    On Mon, 08 Apr 2024 17:54:42 +0000, Javier wrote:

    Also, I suspect HD caching and the increase in HD speed was one of the reasons for the fall in popularity of Perl for writing small system automation tasks that could be done with just shell. But there were
    another reasons, like the disapearance of diversity in the Unix OS
    ecosystem.

    Systems that can legally be called “Unix®” may be essentially extinct, but
    Linux on its own offers more diversity than they could manage, anyway.

    And yes, Perl may not be the Hot New Thing™, but it still lives on.

    On my Debian system:

    ldo@theon:~> apt-cache rdepends perl | sort | uniq | wc -l
    1115

    Perl made easy to write portable scripts that could run on propietary
    Unixen that came with slight incompatibilities in the command line tools (IRIX/Solaris/HP-UX/AIX, etc.)

    I thought the usual way any self-respecting Unix sysadmin fixed that
    problem was by installing the GNU tools.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 15:58:34 2024
    From Newsgroup: comp.lang.misc

    On Mon, 8 Apr 2024 22:14:16 -0000 (UTC)
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There it is again: “maximal space”. The “space” is there to be used. Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure clearer?
    Like I said: eye-travel. If the same amount of information is spread
    out over a larger space, there comes a point where it's actually *more*
    work to read, and it eventually becomes harder for the brain to keep
    track of the relevant context as a result; the "flow" is broken.
    Of course, it's entirely possible (and arguably more common) to err in
    the other direction, and the best thing is to find a good balance - but
    I maintain that a because-it's-there approach to screen space has its
    own pitfalls as well.
    for \
    entry \
    in \
    get_each_record \
    This, for example. Most of your example is quite reasonable, but what
    Earthly purpose is served by breaking up a straightforward construct:
    for entry in get_each_record
    into semantic atoms, let alone staggering them all across the page?
    Splitting components into logical groupings is one thing, but the parts
    here *belong* together; why separate them!?
    (Obviously, there's an element of "de gustibus non est disputandum"
    here, but I am legitimately both baffled by and curious about your line
    of thinking.)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Mon Apr 8 23:02:52 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-08, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There it is again: “maximal space”. The “space” is there to be used. Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure clearer?

    A canvas is two dimensional. That doesn't mean that a chimpanzee with
    a brush is Rembrandt.


    Another example:

    def fill_in_depreciations(tax_year) :
    "(re)inserts depreciation entries for the specified tax year," \
    " based on currently-entered assets."
    sql.cursor.execute \
    (
    "delete from payments where kind = %s and tax_year = %s",
    ["D", tax_year]
    )
    for \
    entry \
    in \
    get_each_record \

    This ain't Rembrandt.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 07:45:51 2024
    From Newsgroup: comp.lang.misc

    On Mon, 8 Apr 2024 19:32:21 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-04-08, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    What makes you so sure about that? Are you assuming that because /you/ >>>are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever
    straw men follow.

    You wrote, "people like you ... would never use a male pronoun if
    talking about nurses", written by you, is already ad hominem;
    it's a direct accusation of hypocrisy, rather than focusing on the
    argument content.

    Mine was correct in general, yours shows you don't understand the difference between sexism and realism. But then the woke mindset is simply a secular religion so logic doesn't apply.

    If you can't handle the ad-hominem ball returned to your court,
    don't serve it!

    In tennis spectators don't generally jump onto the court and return the ball.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Richard Kettlewell@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 08:47:03 2024
    From Newsgroup: comp.lang.misc

    John Ames <commodorejohn@gmail.com> writes:
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There it is again: “maximal space”. The “space” is there to be used. >> Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure
    clearer?

    Like I said: eye-travel. If the same amount of information is spread
    out over a larger space, there comes a point where it's actually *more*
    work to read, and it eventually becomes harder for the brain to keep
    track of the relevant context as a result; the "flow" is broken.

    Also, the more it’s spread out, the less of it you can get on one
    screen, and the resulting need for paging makes the medium-scale
    structure a lot less clear.
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 07:57:24 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-09, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 8 Apr 2024 19:32:21 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-04-08, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    What makes you so sure about that? Are you assuming that because /you/ >>>>are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever >>> straw men follow.

    You wrote, "people like you ... would never use a male pronoun if
    talking about nurses", written by you, is already ad hominem;
    it's a direct accusation of hypocrisy, rather than focusing on the
    argument content.

    Mine was correct in general, yours shows you don't understand the difference between sexism and realism.

    I've not addressed myself to that topic whatsoever, let alone revealed
    a position.
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 10:02:25 2024
    From Newsgroup: comp.lang.misc

    On 09.04.2024 09:45, Muttley@dastardlyhq.com wrote:
    On Mon, 8 Apr 2024 19:32:21 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:

    If you can't handle the ad-hominem ball returned to your court,
    don't serve it!

    In tennis spectators don't generally jump onto the court and return the ball.

    If players missed the goal and hit the net there's ball kids that
    jump onto the court to fetch the misguided balls.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 10:07:13 2024
    From Newsgroup: comp.lang.misc

    On 09.04.2024 09:47, Richard Kettlewell wrote:
    John Ames <commodorejohn@gmail.com> writes:
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There it is again: “maximal space”. The “space” is there to be used.
    Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure
    clearer?

    Like I said: eye-travel. If the same amount of information is spread
    out over a larger space, there comes a point where it's actually *more*
    work to read, and it eventually becomes harder for the brain to keep
    track of the relevant context as a result; the "flow" is broken.

    Also, the more it’s spread out, the less of it you can get on one
    screen, and the resulting need for paging makes the medium-scale
    structure a lot less clear.

    Add structuring code (e.g. using functions) to manage complexity
    and make it possible to keep entities in appropriate sizes.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 10:11:09 2024
    From Newsgroup: comp.lang.misc

    On 09/04/2024 09:47, Richard Kettlewell wrote:
    John Ames <commodorejohn@gmail.com> writes:
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There it is again: “maximal space”. The “space” is there to be used.
    Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure
    clearer?

    Like I said: eye-travel. If the same amount of information is spread
    out over a larger space, there comes a point where it's actually *more*
    work to read, and it eventually becomes harder for the brain to keep
    track of the relevant context as a result; the "flow" is broken.

    Also, the more it’s spread out, the less of it you can get on one
    screen, and the resulting need for paging makes the medium-scale
    structure a lot less clear.


    And if you need line continuation characters - ending the line in "\" in
    this case - it's a sure sign that you are doing something questionable.
    In some cases it is unavoidable, such as for complex macros in C or for
    long lists in bash, but it is extremely rare that it is necessary in
    Python code.

    Comments to say when your loop or functions end is another big red flag
    that the layout is bad.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 08:38:02 2024
    From Newsgroup: comp.lang.misc

    On Tue, 9 Apr 2024 10:11:09 +0200, David Brown wrote:

    Comments to say when your loop or functions end is another big red flag
    that the layout is bad.

    Without #end comments: how easy is it to tell which lines belong to
    the inner function, and which to the outer?

    def set_message(self, message) :

    w_self = weak_ref(self)

    def wrap_message(c_conn, c_message, c_user_data) :
    self = _wderef(w_self, "vtable")
    conn = Connection(dbus.dbus_connection_ref(c_conn))
    msg = Message(dbus.dbus_message_ref(c_message))
    user_data = conn._user_data.get(c_user_data)
    result = message(conn, msg, user_data)
    if asyncio.iscoroutine(result) :
    self.create_task(result)
    result = DBUS.HANDLER_RESULT_HANDLED
    return \
    result

    if message != None :
    self._wrap_message_func = DBUS.ObjectPathMessageFunction(wrap_message)
    else :
    self._wrap_message_func = None
    self._dbobj.message_function = self._wrap_message_func
    return \
    self

    Now, with #end comments (and a #begin as well, for good measure):

    def set_message(self, message) :

    w_self = weak_ref(self)

    def wrap_message(c_conn, c_message, c_user_data) :
    self = _wderef(w_self, "vtable")
    conn = Connection(dbus.dbus_connection_ref(c_conn))
    msg = Message(dbus.dbus_message_ref(c_message))
    user_data = conn._user_data.get(c_user_data)
    result = message(conn, msg, user_data)
    if asyncio.iscoroutine(result) :
    self.create_task(result)
    result = DBUS.HANDLER_RESULT_HANDLED
    #end if
    return \
    result
    #end wrap_message

    #begin set_message
    if message != None :
    self._wrap_message_func = DBUS.ObjectPathMessageFunction(wrap_message)
    else :
    self._wrap_message_func = None
    #end if
    self._dbobj.message_function = self._wrap_message_func
    return \
    self
    #end set_message
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From David Brown@david.brown@hesbynett.no to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 15:22:25 2024
    From Newsgroup: comp.lang.misc

    On 09/04/2024 10:38, Lawrence D'Oliveiro wrote:
    On Tue, 9 Apr 2024 10:11:09 +0200, David Brown wrote:

    Comments to say when your loop or functions end is another big red flag
    that the layout is bad.

    Without #end comments: how easy is it to tell which lines belong to
    the inner function, and which to the outer?


    You could try doing what almost every other Python programmer does - use smaller functions and drop the silly line continuations.

    When you see that you have a style that is very different from all the
    others you see around you, you have to consider what is more likely -
    are you a lone genius that sees what no one else does, or are you doing something weird and unhelpful?

    Now, I know there are plenty of people who think Python's method of determining blocks is not ideal. But look up some statistics comparing
    Pascal and Python usage, and it should be quite clear that begin/end is
    not something many people find necessary.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 15:01:46 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:
    On Mon, 8 Apr 2024 19:32:21 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-04-08, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    What makes you so sure about that? Are you assuming that because /you/ >>>>are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever >>> straw men follow.

    You wrote, "people like you ... would never use a male pronoun if
    talking about nurses", written by you, is already ad hominem;
    it's a direct accusation of hypocrisy, rather than focusing on the
    argument content.

    Mine was correct in general

    Only in your worldview.

    FWIW, at the local A&E, the split is about 50-50.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 15:09:01 2024
    From Newsgroup: comp.lang.misc

    On Tue, 09 Apr 2024 15:01:46 GMT
    scott@slp53.sl.home (Scott Lurndal) wrote:
    Muttley@dastardlyhq.com writes:
    On Mon, 8 Apr 2024 19:32:21 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-04-08, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote:
    On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    What makes you so sure about that? Are you assuming that because /you/ >>>>>are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever >>>> straw men follow.

    You wrote, "people like you ... would never use a male pronoun if
    talking about nurses", written by you, is already ad hominem;
    it's a direct accusation of hypocrisy, rather than focusing on the >>>argument content.

    Mine was correct in general

    Only in your worldview.

    FWIW, at the local A&E, the split is about 50-50.

    What local A&E? Here in the UK the vast majority of nurses are female whereas with doctors its a more even mix.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From scott@scott@slp53.sl.home (Scott Lurndal) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 15:30:15 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:
    On Tue, 09 Apr 2024 15:01:46 GMT
    scott@slp53.sl.home (Scott Lurndal) wrote:
    Muttley@dastardlyhq.com writes:
    On Mon, 8 Apr 2024 19:32:21 -0000 (UTC)
    Kaz Kylheku <643-408-1753@kylheku.com> wrote:
    On 2024-04-08, Muttley@dastardlyhq.com <Muttley@dastardlyhq.com> wrote: >>>>> On Mon, 8 Apr 2024 14:35:48 +0200
    David Brown <david.brown@hesbynett.no> wrote:
    On 08/04/2024 09:47, Muttley@dastardlyhq.com wrote:
    What makes you so sure about that? Are you assuming that because /you/ >>>>>>are sexist, everyone else is?

    An immediate fallacious ad hominem no doubt in order to prop up whatever >>>>> straw men follow.

    You wrote, "people like you ... would never use a male pronoun if >>>>talking about nurses", written by you, is already ad hominem;
    it's a direct accusation of hypocrisy, rather than focusing on the >>>>argument content.

    Mine was correct in general

    Only in your worldview.

    FWIW, at the local A&E, the split is about 50-50.

    What local A&E? Here in the UK the vast majority of nurses are female whereas >with doctors its a more even mix.

    Across the pond.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From John Ames@commodorejohn@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 08:40:09 2024
    From Newsgroup: comp.lang.misc

    On Tue, 9 Apr 2024 15:09:01 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    Mine was correct in general

    Only in your worldview.

    FWIW, at the local A&E, the split is about 50-50.

    What local A&E? Here in the UK the vast majority of nurses are female
    whereas with doctors its a more even mix.

    "I was actually correct in a broadly objective sense, if you discount attestations to the contrary because I don't feel they match my
    specific experience" is a *special* breed of argument :|

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Muttley@Muttley@dastardlyhq.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 16:01:11 2024
    From Newsgroup: comp.lang.misc

    On Tue, 9 Apr 2024 08:40:09 -0700
    John Ames <commodorejohn@gmail.com> wrote:
    On Tue, 9 Apr 2024 15:09:01 -0000 (UTC)
    Muttley@dastardlyhq.com wrote:

    Mine was correct in general

    Only in your worldview.

    FWIW, at the local A&E, the split is about 50-50.

    What local A&E? Here in the UK the vast majority of nurses are female
    whereas with doctors its a more even mix.

    "I was actually correct in a broadly objective sense, if you discount >attestations to the contrary because I don't feel they match my
    specific experience" is a *special* breed of argument :|

    You could say the same thing about the OP.

    I've never been in a hospital where the nurses were anything other than about 95% women and frankly I don't believe the 50-50 split he's citing unless "nurse"
    has a different definition in the USA. Sounds like something he plucked out his arse to try to win a point.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Richard Kettlewell@invalid@invalid.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Tue Apr 9 18:57:40 2024
    From Newsgroup: comp.lang.misc

    Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
    On 09.04.2024 09:47, Richard Kettlewell wrote:
    John Ames <commodorejohn@gmail.com> writes:
    Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    There it is again: “maximal space”. The “space” is there to be used.
    Code may be one-dimensional, but you have a two-dimensional screen to
    display it, why not make use of that, if it makes a complex structure
    clearer?

    Like I said: eye-travel. If the same amount of information is spread
    out over a larger space, there comes a point where it's actually *more*
    work to read, and it eventually becomes harder for the brain to keep
    track of the relevant context as a result; the "flow" is broken.

    Also, the more it’s spread out, the less of it you can get on one
    screen, and the resulting need for paging makes the medium-scale
    structure a lot less clear.

    Add structuring code (e.g. using functions) to manage complexity
    and make it possible to keep entities in appropriate sizes.

    Yes, but that should be driven by the natural structure of the problem,
    rather than by the relationship between layout and screen size.
    --
    https://www.greenend.org.uk/rjk/
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 00:32:47 2024
    From Newsgroup: comp.lang.misc

    On Tue, 9 Apr 2024 15:22:25 +0200, David Brown wrote:

    You could try doing what almost every other Python programmer does - use smaller functions and drop the silly line continuations.

    Fine. Try that with the example I gave.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Kaz Kylheku@643-408-1753@kylheku.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 01:35:10 2024
    From Newsgroup: comp.lang.misc

    On 2024-04-10, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
    On Tue, 9 Apr 2024 15:22:25 +0200, David Brown wrote:

    You could try doing what almost every other Python programmer does - use
    smaller functions and drop the silly line continuations.

    Fine. Try that with the example I gave.

    Maybe you have a Python-coding niece or nephew in the fifth grade who can reformat it for you?

    Meanwhile:

    Pass 1:

    def fill_in_depreciations(tax_year) :
    """
    (re)inserts depreciation entries for the specified tax year,
    based on currently-entered assets.
    """

    sql.cursor.execute("delete from payments where kind = %s and tax_year = %s",
    ["D", tax_year])
    for entry in get_each_record(table_name = "assets, asset_depreciations",
    fields = [
    "assets.description as description",
    "assets.initial_value as initial_value",
    "assets.when_purchased as when_purchased",
    "assets.depreciation_rate as rate",
    "assets.depreciation_method as method",
    "asset_depreciations.depreciation_amount as amount",
    ],
    condition = "assets.asset_id = asset_depreciations.asset_id and"
    " asset_depreciations.tax_year = %s",
    values = [tax_year]):
    sql.cursor.execute("insert into payments set when_made = %(when_made)s,"
    " description = %(description)s, other_party_name = \"\","
    " amount = %(amount)d, kind = \"D\", tax_year = %(tax_year)d"
    % { "when_made" : end_for_tax_year(tax_year) - 1,
    "description" : sql_string("%s: %s $%s at %d%% from %s" %
    (entry["description"],
    entry["method"],
    format_amount(entry["initial_value"]),
    entry["rate"],
    format_date(entry["when_purchased"]))),
    "amount" : - entry["amount"],
    "tax_year" : tax_year })



    Pass 2: fits into 80 cols and everything:

    def fill_in_depreciations(tax_year) :
    """
    (re)inserts depreciation entries for the specified tax year,
    based on currently-entered assets."
    """

    table = "assets, asset_depreciations"

    fields = ["assets.description as description",
    "assets.initial_value as initial_value",
    "assets.when_purchased as when_purchased",
    "assets.depreciation_rate as rate",
    "assets.depreciation_method as method",
    "asset_depreciations.depreciation_amount as amount"]

    condition = ("assets.asset_id = asset_depreciations.asset_id and"
    " asset_depreciations.tax_year = %s")

    insert = ("insert into payments set when_made = %(when_made)s,"
    " description = %(description)s, other_party_name = \"\","
    " amount = %(amount)d, kind = \"D\", tax_year = %(tax_year)d")

    sql.cursor.execute("delete from payments where kind = %s and tax_year = %s",
    ["D", tax_year])

    for entry in get_each_record(table_name = table_name, fields = fields,
    condition = condition, values = [tax_year]):
    desc = sql_string("%s: %s $%s at %d%% from %s" %
    (entry["description"],
    entry["method"],
    format_amount(entry["initial_value"]),
    entry["rate"],
    format_date(entry["when_purchased"])))
    sql.cursor.execute(insert %
    {"when_made" : end_for_tax_year(tax_year) - 1,
    "description" : desc,
    "amount" : - entry["amount"],
    "tax_year" : tax_year})
    --
    TXR Programming Language: http://nongnu.org/txr
    Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
    Mastodon: @Kazinator@mstdn.ca
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Keith Thompson@Keith.S.Thompson+u@gmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 00:36:19 2024
    From Newsgroup: comp.lang.misc

    Muttley@dastardlyhq.com writes:
    [...]
    ITYM "he" would allow HIMself.

    I am looking forward with great eagerness to this subthread dying out,
    and I encourage everyone to help make that happen.
    --
    Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
    Working, but not speaking, for Medtronic
    void Void(void) { Void(); } /* The recursive call of the void */
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andy Walker@anw@cuboid.co.uk to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 10:10:00 2024
    From Newsgroup: comp.lang.misc

    On 08/04/2024 13:53, Janis Papanagnou wrote:
    On 07.04.2024 23:05, Lawrence D'Oliveiro wrote:
    Even in the 21st century, articles like
    <https:// [... snipped, to avoid giving it more publicity -- ANW]
    An extremely badly written article in *all* aspects (form, content,
    facts, quality, etc.).

    Agreed. I think it is a prime candidate for the worst serious supposedly-scientific web page I've ever seen. If it was written by a
    12yo with access to ChatGPT, that would not surprise me. It has two
    indirect redeeming features:

    -- It pointed me at "https://opensource.com/article/20/6/algol68",
    which /is/ worth reading.

    -- Its list of the A60 committee members prompted me to check, and I
    found, somewhat to my surprise, that one of them, Mike Woodger,
    who I worked with briefly nearly 50 years ago, is still alive, aged
    101. Having recently seen a couple of new scientific papers by F. G.
    Smith, the former Astronomer Royal, aged 100, perhaps we are entering
    a new era of golden oldies? Richard Guy made it to 103, and was still
    working past his century. I know of a fair number of nonagenarians,
    not least Tom Lehrer [96 yesterday], but [mostly] not whether they are
    still active.
    --
    Andy Walker, Nottingham.
    Andy's music pages: www.cuboid.me.uk/andy/Music
    Composer of the day: www.cuboid.me.uk/andy/Music/Composers/Necke
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From gazelle@gazelle@shell.xmission.com (Kenny McCormack) to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 12:05:10 2024
    From Newsgroup: comp.lang.misc

    In article <87jzl5fz4c.fsf@nosuchdomain.example.com>,
    Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
    Muttley@dastardlyhq.com writes:
    [...]
    ITYM "he" would allow HIMself.

    I am looking forward with great eagerness to this subthread dying out,
    and I encourage everyone to help make that happen.

    Leader Keith has spoken. All must obey.
    --
    It's possible that leasing office space to a Starbucks is a greater liability in today's GOP than is hitting your mother on the head with a hammer.
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 14:43:54 2024
    From Newsgroup: comp.lang.misc

    On 10.04.2024 11:10, Andy Walker wrote:
    On 08/04/2024 13:53, Janis Papanagnou wrote:
    On 07.04.2024 23:05, Lawrence D'Oliveiro wrote:
    Even in the 21st century, articles like
    <https:// [... snipped, to avoid giving it more publicity -- ANW]
    An extremely badly written article in *all* aspects (form, content,
    facts, quality, etc.).

    Agreed. I think it is a prime candidate for the worst serious supposedly-scientific web page I've ever seen.

    Oh, I haven't perceived its intention as being scientific; yet worse
    if that's the case of that web site in general. (I've just read that
    one article.)

    If it was written by a
    12yo with access to ChatGPT, that would not surprise me.

    :-) Wouldn't surprise these days, indeed.

    It has two
    indirect redeeming features:

    -- It pointed me at "https://opensource.com/article/20/6/algol68",
    which /is/ worth reading.

    Indeed interesting. (I've meanwhile, after your hint, read it.)


    -- Its list of the A60 committee members prompted me to check, and I
    found, somewhat to my surprise, that one of them, Mike Woodger,
    who I worked with briefly nearly 50 years ago, is still alive, aged
    101. Having recently seen a couple of new scientific papers by F. G.
    Smith, the former Astronomer Royal, aged 100, perhaps we are entering
    a new era of golden oldies? Richard Guy made it to 103, and was still
    working past his century. I know of a fair number of nonagenarians,
    not least Tom Lehrer [96 yesterday], but [mostly] not whether they are
    still active.

    Interestingly, WRT committee members, that was one detail that annoyed
    me; Friedrich L. Bauer was mentioned twice, once as "Friedrich Baue"
    and once as "Friedric L. Bauer", both wrongly spelled (and not even consistently wrong). - He died 9 years ago at age of 91. Two weeks ago
    would have been his centenary! He established the CS chair here at the university and (as is said) held the very first "official" CS lectures
    in Germany. - I had the opportunity to hear his lectures during the
    1980's.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Wed Apr 10 19:03:41 2024
    From Newsgroup: comp.lang.misc

    On 10.04.2024 14:43, Janis Papanagnou wrote:

    [ Friedrich L. Bauer ] - He died 9 years ago at age of 91.
    Two weeks ago would have been his centenary!

    Correction: Two weeks ago was his 9th death day anniversary.
    His centenary will be in two months. - Just noticed my error,
    sorry.

    Janis


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 12 15:48:37 2024
    From Newsgroup: comp.lang.misc

    On 08.04.2024 19:54, Javier wrote:

    I don't worry about that anymore. My bash scripts run blazing fast
    in my laptop with an SSD.

    If speed would be an issue you could also switch to faster POSIX
    shells than Bash, like Ksh.

    But speed very much depend on the tasks you actually do with them.
    Sometimes Shells are "misused".

    I guess it was an issue at the time Perl
    appeared (1987), although TBH I didn't experience it myself, since at
    that time I wasn't a Unix user.

    Also, I suspect HD caching and the increase in HD speed was one of the reasons for the fall in popularity of Perl for writing small system automation tasks that could be done with just shell. But there were
    another reasons, like the disapearance of diversity in the Unix OS ecosystem. Perl made easy to write portable scripts that could run on propietary Unixen that came with slight incompatibilities in the command line tools (IRIX/Solaris/HP-UX/AIX, etc.)

    Some notes...
    You have the portability only if you use the same version on all
    target systems.
    To write scripts portably you use standards; like POSIX (including
    the POSIX shells).
    I suppose there's no Perl standard yet?
    You may not have Perl in professional environments available (for
    security considerations, maintenance decisions, policies).


    Perhaps somebody here who uses (or used to use) Perl for system
    automation tasks can tell us more about their personal reasons
    for prefering (or used to prefer) Perl over shell.

    I've programmed in Perl but I'm no Perl-programmer notwithstanding.
    Some more or less obvious reasons I see...
    Abstraction of diverse Unix utilities' interfaces.
    Supporting data structures (beyond primitive arrays).
    Expressiveness.
    Extensive libraries and supporting solutions available.
    One tool instead of a tool chest. (A simplified view, granted.)
    Less quirks than Shell. (I'm saying that as a decades long and
    experienced Shell programmer.)
    I'm reluctant to speak about Shell's crude syntax as one reason,
    since I also dislike Perl's.

    Janis

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Janis Papanagnou@janis_papanagnou+ng@hotmail.com to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Fri Apr 12 15:55:30 2024
    From Newsgroup: comp.lang.misc

    On 07.04.2024 05:46, Keith Thompson wrote:
    Lawrence D'Oliveiro <ldo@nz.invalid> writes:
    On Sun, 07 Apr 2024 00:01:43 +0000, Javier wrote:

    The downside is the loss of performance because of disk access for
    trivial things like 'nfiles=$(ls | wc -l)'.

    Well, you could save one process creation by writing
    “nfiles=$(echo * | wc -l)” instead. But that would still not be strictly
    correct.

    If that saves a process, it's because echo is builtin.

    You can use only built-ins, e.g. along the line of

    set * ; nfiles=$#

    (It's not only faster but also has less issues.)

    Janis

    But it will set
    $nfiles to 1 (unless you happen to have files with newlines in their
    names). Both skip hidden files, which may or may not be what you want.

    [...]


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Lawrence D'Oliveiro@ldo@nz.invalid to comp.unix.shell,comp.unix.programmer,comp.lang.misc on Sat Apr 13 21:54:58 2024
    From Newsgroup: comp.lang.misc

    On 13 Apr 2024 08:18:07 GMT, Stefan Ram wrote:

    Python:

    There should be one - and preferably only one - obvious way to do it.
    Although that way may not be obvious at first unless you're Dutch.

    Actually, given the overlap between functions and classes, there are often multiple ways to do things.

    Unlike Perl, most of them will be more-or-less comprehensible.

    Algol 68 was also masterminded by a Netherlander, who was also the pioneer
    of two-level grammars: Aard van Wijngaarden.

    Coincidence? You be the judge.
    --- Synchronet 3.20a-Linux NewsLink 1.114