[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Making Lua unique through supporting natural language texts as valid script code
- From: Claudio Grondi <claudio.grondi@...>
- Date: Mon, 2 Oct 2023 03:41:12 +0200
On 10/1/23 21:33, Sean Conner wrote:
The major problem here is allowing Lua to use STX and ETX to mark long
strings, but getting existing systems to make it easy to type STX and ETX.
I would be hard pressed to get my preferred text editor to include those
characters into a file, expecially ETX (which is Ctrl-C, which a lot, *a
lot* of programs, interpret as an interrupt character.
Yes, a new editor or system can be created that allows the use of
non-printable characters, but now you have to convince people to use your
editor or system. And the industry is littered with such projects, most
never finished.
In my eyes the attempt to try to make software working on any hardware
platform and with any operating system out there limits the freedom of
features and options and leads to code extremely inflated in size
because of coming with all the options you don't need on the platform
and OS you are using. It goes that far that code handling the cases
takes much more storage space than the actual code you need to provide a
feature. The object oriented approach pollutes because of the for the
actual function unnecessary usage of multi-level indirections the code
even more. The core functionality gets this way buried below the part
handling all of the possible cases and leads to increased download size
and storage space and as a consequence of this to increased amount of
energy required to handle it.
In other words you are forced to spend your money on paying increased
electricity and used online download size bills just only because of the
craziness of the mainstream approach. Why using my Linux Mint 21.2 Xfce
system should I spend more money for my electricity and download size
bill just only because there are also Microsoft Windows or Apple systems
out there??? Why should I bother that your preferred editor can't handle
the input of the full ASCII range? It's your beer what are you are using
and you need to live with the consequences of your choice. If the core
of the oOo idea is nothing for you, than it is just that way. It's not
helpful to point out that you are not ready to spend some thoughts on it.
On 10/1/23 17:51, Lars Müller wrote:
2. allow function calls by specifying the function name only (without
using braces and without the need of passing a parameter)
2. Would break existing code and introduce many syntactic ambiguities.
Consider the simple p = print. Is this an assignment p = print() or an
assignment p = print?
In my general concept of an oOo system using a text editor for invoking
executable actions instead of a shell usage of an assignment isn't part
of the concept. And because p=print() and p=print is already handled in
Lua, there is no need to worry about ambiguities. It's ok as it is ...
As Lars stated, this would break existing code:
function f() return 42 end
x = f ; print(x)
function: 0x8cc2020
x = f() ; print(x)
42
As you stated above:
Lua would require some minor changes only, which if I am not mistaken
won't break any past code and should be relatively easy to implement, in
order to support natural language texts as valid script code.
This breaks existing Lua code.
Also, what does "oOo" mean? "Out-of-order"? "Object-Oriented-something?"
It's not clear.
One of the goals of oOo is to care about the aesthetics of the code.
oOo ... is just round and not edgy with multiple line ends. Why not
accept a nice looking name without asking about an acronym or
abbreviation? Why not just enjoy the picture? `o` stands for what a
human needs for understanding, `oo` stands for the code required to
create executable files, `ooo` stands for all the executable files which
translate between different "languages". The revelation of the oOo
system is to see computing as nothing else as translation between
different languages ... to get the core of the idea is maybe not easy if
your way of thinking rejects the fact that what software actual really
does is to translate a number from one language to another. But it
appears to me that once accepted this kind of point of view will lead to
simplicity ... like the heliocentric point of view did in the past.
3. extend [_a-zA-z0-9] characters allowed in symbol names with ASCII
value 0x1F (Unit Separator) and `-` which will be treated like [0-9] not
allowed as first symbol name characters
3. Again a nonprintable control character. Adding hyphen would introduce
ambiguities, breaking existing code again: Is a-b the name a-b or the
subtraction a - b?
`a-b` is clearly a name.
In your opinion. In mine, "a-b" is clearly two variables being
subtracted. And in most languages, this is the case. There is only one
language I know of (there could be others) where this would be a valid
label, and that's Forth.
To achieve subtraction you would need to
separate the operator from the variable names `a - b`. Like a*b could be
also made a name .. In the general concept of oOo system a*b will be a
name of a function which performs multiplication of the value stored in
a variable with name `a` with the value stored in the variable with name
`b`.
Why not logically AND the value of a with the value of b? Or match the
pattern stored in a AND match the pattern stored in b (as in LPEG)?
It's your choice how you would like to have it. oOo is about
customizing. Is about creation of own way of expressing functionality.
For your own purposes which need not to be commonly accepted or
understood. It's all about making the system understand the language you
use in YOUR inner thoughts and concepts for which there may be no word
or symbol known out there. You create it for your use case ... and enjoy
it like a person who trained the own dog to do tricks on by
self-determined signals. Why not put the effort of adapting the system
to what you like instead of using what the system comes with? If you
don't like the shape of `oOo` ... use xXx if it looks better in your
eyes. In my eyes xXx hurts, stops, eliminates, instead of creating a
nice round impression.
The idea is to refrain from usage of internal variable names in
usual sense, replacing them with a mechanism of getting the values from
appropriate named files. And as files allow any characters in them ...
there is actually no reason to restrict variable and function names to
[_a-zA-z0-9], but .. to achieve simplicity and avoid the need to cope
with utf-8 encoding and Unicode I tend to prefer the idea to stick with
one-byte ASCII and an own kind of encoding with appropriate true type
font for use in a text editor to write scripts.
Good luck in getting it adapted. People who don't speak English will
probably want to use their own language.
The core idea of oOo is that the possibility to use own language is
perfectly in line with it. YOU create the language you want to use to
communicate your intents to the system instead of using a language
created by someone else you need first to learn in order to understand
the context out of which another person created it in this and not other
way.
Let me give an example of the main idea I want to create as a proof of
concept using Lua.
Let's prepare first some functions for later use:
function let_x_be(val) x = tonumber(val) end
function let_y_be(val) y = tonumber(val) end
function let_z_be_sum_of_x_and_y () z = x + y end
With this functions defined, Lua already allows to write following code:
let_x_be '0xff' _=',' let_y_be '15' _='and' let_z_be_sum_of_x_and_y''
The result of the code above is:
x
255
y
15
z
270
And what's wrong with?
let_x_be = 255
let_y_be = 15
let_x_be_sum_of_x_and_y = let_x_be + let_y_be
That's a hell of a lot easier to type that your example. And if you need to
explain why, you can always use comments. Or Literate Programming, which
encourages one to extensively document the program without regard to how the
code needs to be structured.
What is wrong with
`x = 255 y = 15 z = x+y`
?
In my eyes it leads to freedom of using
`a = 255 b = 15 c = a+b`
where what actual happens is addition of two numbers. My gut feeling
tells me that
`addTwoNumbers` is what actual happens ... is the actual action. With
some consequently used conventions the function addTwoNumbers will load
a number value from the file named `x.in` and from the file named `y.in`
writing the result to the file named `addTwoNumbers.out`. This makes
what happens available for any language and any other executable to
perform further actions on it.
In my eyes there need to be a function: `obtainValuesFromFormula` which
will load a string from a file named `Formula.in` containing the string
`a = 255 b = 15 c = a+b` and writing to the file named
`obtainValuesFromFormula.out` the string: `c = 270`. This way you can
use the approach with assignments if you like to use it and need for
this purpose an "intelligent" function which will be able to "know" what
to provide as result. With a file storing `c = 270` you can use the
string in any programming language of your choice for further processing.
The actual problem I see is to explain to someone who is deeply into the
existing programming mechanisms and paradigms what the final goal and
concept of oOo is, because it goes beyond usual understanding of what a
programming language is for.
The core idea is to use the keyboard to write a text in a text editor and
invoke all the systems functionality from there using a custom language
created out of the available functionalities (mixing usage of executable
files written in various programming languages).
Sounds like you are recreated shell scripts. Or Apple Script. Also, how
would one use your system to write a new text editor that supported these
ideas? Just curious.
The oOo system isn't actual a system you need to learn and to use. This
is what is maybe so hard to understand in first place. The oOo system is
a set of tools which should make it easy for you to create your own
system you can enjoy using because it is exactly as you have created it
yourself.
The oOo systems goal is to provide guidelines and a new way of
understanding what data processing actually is. Enabling the person who
has grasped what it is about to create an own specific custom system
able to "understand" the intention of the creator expressed in a custom
for this purpose created own language which could be for example a
language very near to the natural spoken English one as this is the
universal world language people agreed to use for communication to
others and probably also mostly to use while thinking.
HERE some main thoughts I was able to get written down out of the "idea"
which is the origin of it all:
The Tower of Babel:
The story of the philosophy behind the oOo art of shaping
thought processes and the related approach of creating a set of
conventions for the purpose of own custom individual design of a
human-computer interface begins at the Tower of Babel where God confused
the languages of humanity so that they could no longer communicate with
each other (Genesis 11:7).
individualMetaLang:
To understand what the concept of individualMetaLang is
about you need to know that there is something else "within" ("within"
in quotation marks because there is no known physical 3D
universe/world/body location you can track it down to reside there) you
which is more the actual you than by you percepted awareness of
yourself. The actual you is capable of watching your thoughts injecting
new ones into the present thought stream which then can change own
emotional state and as effect of that change the course of own behavior.
It is maybe fundamentally wrong to consider 'this something else' to use
a language, but it seems helpful to explain what oOo is about using
the concept/idea of an individualMetaLang Meta-Language which requires
translation to individualMindLang Mind Language enabling awareness
what the own thoughts are about. For practical purposes the
consideration of interaction with the outer world and a electronic
devices like computers it will be sufficient to start the chain of
origins of an intention which needs to be communicated at the level of
individualMindLang , the level many people believe to be the actual
themselves and the origin of conscious decisions governing their
behavior. Find out what you believe to be the actual you asking yourself
the question: "Do I believe what I think?"
individualMindLang:
From the point of view of oOo a human being is interacting
with its environment using various different "build-in" and partially
redundant systems with one of them being the mind using thoughts in a
process called thinking with the main goal of generating useful
intelligent responses to continuously ongoing changes within the human
body and the far and near surrounding of it (the only thing staying the
same all the time being the only still part of the Universe is the
actual you at the level of individualMetaLang ).
The human mind uses chains of thoughts in the process of
interpretation of incoming sensory information about the ongoing
changes. These chains of thoughts can be considered to be a kind of
inner language specific to each single individual. Let's give this
language (which is a set of different ideas/ concepts/symbols/terms and
conventions of using them in a thought process) a name:
individualMindLang where Lang is an abbreviation of the word Language
and Mind indicates the context of a brain and thinking.
NatLang:
Let's assign to the set of tools a human uses in order to share
intentions, needs, observations, memories or information about the own
ongoing thought processes with other human beings a name NatLang
meaning Natural Language.
cnNatLang, deNatLang, enNatLang, ... :
The humanity developed since Babel many different languages.
oOo uses to distinguish between them the suffix used in Internet to
identify a country of origin of a domain name. So for example the
context of English language is described in oOo using "en"
and/or "us", the context of German lanuage using "de", the context of
Chinese language using "cn", ... . To achieve brevity in cases of
obvious context oOo skips mentioning the "Nat" part: cnLang, deLang,
enLang or goes one step further skipping "Lang" too: cn, de, en, ...
PrgLang:
There are plenty of different programming languages created for
the purpose of programming a electronic devices (like computer,
notebook, cellphone, ...) . To express the context of programming an
electronic device using a text based file oOo uses the term PrgLang .
shPrgLang, luaPrgLang, pyPrgLang, ... :
oOo identifies programming languages using the default
file name extension used for naming of script files written in these
programming languages. shPrgLang means for example a shell script
file which commands are described by the POSIX standard, luaPrgLang
means a script file written in the Lua programming language, pyPrgLang
means Python as the target interpreter for the script.
In practice each existing programming language provides
functions/methods/modules which need an own specific way of usage by
passing to them information formulated in a way the
functions/methods/modules can process, i.e. using a specific
sub-language of the programming language. This fact contributes to the
"Tower of Babel" effect and may require further clarification. For
example pyPrgLangRegex indicates a regular expression pattern
supported by the Python build-in re module, where in order to
distinguish it from a regular expression pattern supported by the
external Python regex module the term pyPrgLangRegexModule is used.
Different versions of same programming language may support
different features using for this purpose a modified langage
contributing this way to the "Tower of Babel" effect. The consequence of
this is a need for further clarification of the context. In other words,
the general category of being for example a pyPrgLang script may
require further details like py2.7prgLang, py3.10prgLang, etc.
bashPrgLang, dashPrgLang, findPrgLang, grepPrgLang, lsPrgLang, ... :
The way how the parameter of an executable used on a command
line need to be specified to be properly interpreted by the executable
is considered by oOo to be a language specific to this executable.
To clearly identify in oOo the executable which is the context of
the "parameter-language", terms as for example grepPrgLang are used in
which the prefix is the base name of the executable file used on the
shell command line.
Once you have got the main idea of what I am actually after, then you will
much better understand how to help to achieve it providing the appropriate
language means making it possible. In my eyes Lua is the best language
available for this purpose if slightly modified to support more freedom of
choice while writing code.
You need to clarify your ideas, and personally, I'm not sure if Lua is the
best choice for this---yes, the code can be modified but at that point, it's
no longer Lua.
The idea is that it can be beneficial for Lua to provide the
modifications without breaking what is already there and extending this
way how it can be used. Making it possible to write code which reads
like usual text and at the same time perform what is described may help
to make Lua the most popular programming language out there ... It
should feel like a conversation with ChatGPT ... able to generate
scripting code out of precise instructions given in spoken language and
make the code executable to achieve what was described as required.
In combination with a text editor which can be scripted using Lua the
impact of what becomes then possible and how powerful it can be could
have an enormous impact on the world of computing and software.
Claudio