syntax difference

Bart bc at freeuk.com
Tue Jun 19 05:19:15 EDT 2018


On 19/06/2018 06:08, Chris Angelico wrote:
> On Tue, Jun 19, 2018 at 1:46 PM, Dan Stromberg <drsalists at gmail.com> wrote:
>> Great languages are small but extensible, easy to read, and don't require
>> learning a lot before you can get started writing code or reading someone
>> else's code.
>>
>> Great languages: C and Scheme.  And Python.
>>
>> But isn't Lua smaller than Python?  That thought worries me a little.
> 
> It's a lot smaller. And that worries me ONLY to the extent that I
> might, at some point, have to write something in Lua. I would much
> rather use a richer language than a poorer one, any day.
> 
> A well-designed language has linear complexity, quadratic power. You
> learn new language constructs and they are completely orthogonal; you
> use those constructs and they interact infinitely. Python isn't quite
> 100% there (there are some odd edge cases), but it's close.


My own dynamic language is much smaller than Python, much less dynamic, 
much less extendable, and lower level.

Yet it might have a dozen highly useful features, ones I consider basic, 
that are already built-in and Just Work without having to grapple with 
innumerable, incompatible add-ons.

(What, I have to list them? Let's see:

* Goto (yes this /can/ be very useful)

* Pointers (this allows some of the features below)

* Swap(x,y) (evaluate each once unlike a,y=y,x)

* Reference parameters

* Mutable records

* Mutable and in-place modifiable strings

* Named constants

* Simple enums

* 'Tabledata' (too hard to explain; mix of enums and linked tables)

* Integer sets (Pascal-like sets)

* Bit indexing (eg. a.[i] to get the i'th bit, or a.[0..7])

* Switch statement (like C)

* Case statement (switch but for any types and for runtime expressions)

* N-way select (n|a,b,c,...|z); only one expr evaluated, z is default)

* Increment/decrement ops

* C-style packed struct types

* Direct access to native-code functions in external DLL/.so files

* Type punning

* Byte-code compiler will always compile all modules of app to single-
   byte-code file (very fast too)

* The interpreter is a single executable file. (Distribute any app as 
one exe plus one byte-code program file; or they can be trivially 
combined into one file)

* Built-in read statement: readln a,b,c

* Bit arrays (including 1, 2 and 4-bit elements)

* Packed arrays of C-style types

* View-slices

* Stop or 'stop x' (not a big feature, but it's there).

* 'main' function replaces all the '__main__ business; it will be called 
first if present.

* Dedicated loop statements for endless loop and repeat N times

Is that a dozen yet? Sorry it's about two dozen, of things which I don't 
think are in Python, or which may require add-ons.)

-- 
bart



More information about the Python-list mailing list