On Tue, Jun 16, 2020 at 11:14:24AM +0300, Paul Sokolovsky wrote:

> There's a reason why even projects otherwise largely written in Python,
> use a different language (like JavaScript) when they need
> easy-for-users scripting capabilities. A random example is
> https://github.com/frida/frida . That's because such projects want to
> let their users write one-liners like:
> 
> for_each_kaboom(function (kaboom) {print("here's kaboom", saboom);
> for (sub in kaboom) print(sub); }) 

What's so special about the ability to write one-liners?

I trust that you agree that *limiting* users to only one line would be a 
terrible idea. So your scripting language surely will allow multiple 
lines of code.

But if you give users the ability to write multiple lines of code, then 
what advantage is there to encourage them to cram them into a single 
line?

Forth is a free-form concatenative language where whitespace separates 
words, and it lacks even the concept of "lines of code". To the 
interpreter, every Forth program is, or might as well be, a single line 
of code. You can literally write Forth code without once touching the 
Enter key, if you so choose.

But in practice, everyone uses multiple lines, not just to separate word 
definitions but even within a single word once they exceed a certain 
level of complexity. As soon as a word contains loops or branches, the 
two dimensional structure is essential for the sake of maintainability 
and readability.

In brace languages, there are a whole mountain of errors that occur when 
the logical structure of the program, as defined by the braces, doesn't 
match the apparent structure of the program, as seen by the programmer 
who is guided by indentation. These errors are rare in Python.

(I was going to say "impossible", but I suppose that a sufficiently 
clever person could manage one using nested comprehensions. But they're 
impossible using regular for-loops and other block structures.)

All Python does is require what people -- at least sensible people -- 
are already doing.


> And while majority of people just leave Python behind in such cases,
> some people spent so much time with Python, that they refuse to (for
> they know that outside there's only bigger mess).

So wait, if you acknowledge that outside is only a bigger mess, why do 
you want to introduce that mess into Python and drag it down to that 
level? I honestly don't understand the point of your comment? Are you in 
favour of, or against, adding braces to Python?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/PSF5OEQZZJLQBL35VJ3TJOHI6DSK62EN/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to