Re Atari BASIC versis Python versus Lua in 1982...

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Re Atari BASIC versis Python versus Lua in 1982...

sur-behoffski
On 03/17/17 15:14, Martin <...> wrote:

> Looks like author compares programming languages by comparing
> implementations. It's like comparing mathematicians by their
> body mass.
>
> But interesting question, if Lua was released say in 1982, would
> it eliminated BASIC family?

Would the C compiler in 1982 be C90 (C89)-compliant?  What about
complying with the original K & R publication from 1978?

Okay, apologies -- I couldn't resist the metaphysical joke.

-- s-b etc.

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Dirk Laurie-2
2017-03-17 9:26 GMT+02:00 sur-behoffski <[hidden email]>:
> On 03/17/17 15:14, Martin <...> wrote:

>> Looks like author compares programming languages by comparing
>> implementations. It's like comparing mathematicians by their
>> body mass.
>>
>> But interesting question, if Lua was released say in 1982, would
>> it eliminated BASIC family?

The main selling point of Basic was that its interpreter was small
enough to fit into an 8K ROM.

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Enrico Colombini
On 17-Mar-17 09:20, Dirk Laurie wrote:
> The main selling point of Basic was that its interpreter was small
> enough to fit into an 8K ROM.

Another point, not often considered, was its conceptual simplicity:
anybody could understand how to use it, so anybodyd did.

Other languages offer more power at the price of either complexity of
technical details (e.g. the C family) or deeper conceptual thinking
(e.g. the Lisp family, including Lua) and they have libraries to be
studied. They tend to be hard to master for non-technical people.

Lua makes a great effort to be simple on the surface (and it easily
beats most other languages here), but making full use of its non-trivial
power requires structured thinking.

BASIC could be reasonably understood by non-programmers, so many people
wrote programs in their domain of expertise. They were unrefined and
naive programs, but they often worked fine because the authors knew
their trade well.

Today's languages require professional programmers... and we often have
communication problems between the subject expert and the technical
expert. Assuming they are both actually expert, of course ;-)

--
   Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Laurent FAILLIE
Very interesting discussion, indeed :)

When I started with Lua, I made a parallel with the BASIC (the one from 80', the real one, not VB with is far away vs original BASIC concept) : Lua syntax is simple and accessible (for basic tasks), learning curve is very fast and even non programmer can progress easily.

But I faced rapidly 2 pitfalls :
- the 1st one is strings manipulation : sooner, you need to master RegEx to do even simple tasks with strings and I think it's a showstopper for beginners. Lua is missing simple but powerful string manipulation functions as the Basic has.
- the documentation. https://www.lua.org/manual/ is good ... but when you already knows a bit the language ... again, it's perhaps due to missing of non RegEx strings manipulation function.

Now, I have a quite "advanced" Lua usage : I love its lightness, how its (almost) easy to create a symbiosis between C (for low level / complex / resources consuming ... parts) and Lua (end user scripting). But the lack of affordable documentation or tutorials makes things sometime difficult. Coming to my mind :
* How to integrate Lua in a multi-threaded application when you don't want/can't recompile Lua ?
* How to launch Lua function again in multi-threaded application (passing function reference b/w context) ?
* How to retrieve data inside nested tables ?
* ...

Finally, I succeeded and I'm "proud" of results : https://github.com/destroyedlolo/Selene and https://github.com/destroyedlolo/Marcel which are matching my objectives.
As you can see, I'm sticking with 5.1 ... because luaL_register() has been deprecated and I was unable to find a clear way to migrate code like 

static const struct luaL_reg SelSurfaceLib [] = {
{"BlittingFlagsConst", BlittingFlagsConst},
... ,
{"CircleQuarterConst", CircleQuarterConst},
{"create", createsurface},
{NULL, NULL}
};

static const struct luaL_reg SelSurfaceM [] = {
{"Release", SurfaceRelease},
{"destroy", SurfaceRelease}, /* Alias */
...
{"restore", SurfaceRestore},
{NULL, NULL}
};

void _include_SelSurface( lua_State *L ){
luaL_newmetatable(L, "SelSurface");
lua_pushstring(L, "__index");
lua_pushvalue(L, -2);
lua_settable(L, -3); /* metatable.__index = metatable */
luaL_register(L, NULL, SelSurfaceM);
luaL_register(L,"SelSurface", SelSurfaceLib);
}

to newer Lua :(

Thanks

Laurent





Le Vendredi 17 mars 2017 9h45, Enrico Colombini <[hidden email]> a écrit :


On 17-Mar-17 09:20, Dirk Laurie wrote:

> The main selling point of Basic was that its interpreter was small
> enough to fit into an 8K ROM.


Another point, not often considered, was its conceptual simplicity:
anybody could understand how to use it, so anybodyd did.

Other languages offer more power at the price of either complexity of
technical details (e.g. the C family) or deeper conceptual thinking
(e.g. the Lisp family, including Lua) and they have libraries to be
studied. They tend to be hard to master for non-technical people.

Lua makes a great effort to be simple on the surface (and it easily
beats most other languages here), but making full use of its non-trivial
power requires structured thinking.

BASIC could be reasonably understood by non-programmers, so many people
wrote programs in their domain of expertise. They were unrefined and
naive programs, but they often worked fine because the authors knew
their trade well.

Today's languages require professional programmers... and we often have
communication problems between the subject expert and the technical
expert. Assuming they are both actually expert, of course ;-)

--
  Enrico




Reply | Threaded
Open this post in threaded view
|

Re: Re: Re Atari BASIC versis Python versus Lua in 1982...

Frank Kastenholz-2
In reply to this post by sur-behoffski
 
 

On 03/17/17, Dirk Laurie wrote:

>2017-03-17 9:26 GMT+02:00 sur-behoffski <[hidden email]>:
>> On 03/17/17 15:14, Martin <...> wrote:
>
>>> Looks like author compares programming languages by comparing
>>> implementations. It's like comparing mathematicians by their
>>> body mass.
>>>
>>> But interesting question, if Lua was released say in 1982, would
>>> it eliminated BASIC family?
>
>The main selling point of Basic was that its interpreter was small
>enough to fit into an 8K ROM.


A significant selling point of Lua is that it fits in <<1mbyte of storage.




Frank Kastenholz


Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Andrew Starks-2
In reply to this post by Enrico Colombini

On Fri, Mar 17, 2017 at 03:45 Enrico Colombini <[hidden email]> wrote:
On 17-Mar-17 09:20, Dirk Laurie wrote:
> The main selling point of Basic was that its interpreter was small
> enough to fit into an 8K ROM.

Another point, not often considered, was its conceptual simplicity:
anybody could understand how to use it, so anybodyd did.

Other languages offer more power at the price of either complexity of
technical details (e.g. the C family) or deeper conceptual thinking
(e.g. the Lisp family, including Lua) and they have libraries to be
studied. They tend to be hard to master for non-technical people.

Lua makes a great effort to be simple on the surface (and it easily
beats most other languages here), but making full use of its non-trivial
power requires structured thinking.

I may have the particular scientist mixed up, but I believe it was Robert Hooke[1] who I am thinking of... He made illustrations of insects that were so striking in their accuracy and detail, that anyone who saw them would cry out with praise. 

Hooke would not receive this well. He was frustrated by their crudeness compared to the nature they were attempting to capture. His complaint was that when you peered more closely at his drawings, they became corse and ugly --- rough ink strokes on fiber that only revealed the limitations of the artist and the medium. 

By contrast, when a microscope was applied to nature, fractal beauty and complexity was revealed.

Systems built on simple constructs have that feature. I'm not quite suggesting that Lua is on par with the natural beauty that life brings. But I am saying that insofar as a computer language can be in possession of that quality, it does.

On the surface, it is simple and you can interact with it without much further appreciation. The closer you study it and the deeper your understanding of it becomes, the more complex it becomes, even as you begin to understand that it is even simpler than you once appreciated. 

This is why, even though I have not had the good fortune to program in quite some time, I still follow this list. I appreciate Lua as something uniquely artful amongst the technological works that I've studied. 

-Andrew

[1] it would be poetic if I miss-applied credit to Robert Hooke, given his treatment by history. 
Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Enrico Colombini
On 17-Mar-17 16:01, Andrew Starks wrote:

> Systems built on simple constructs have that feature. I'm not quite
> suggesting that Lua is on par with the natural beauty that life brings. But
> I am saying that insofar as a computer language can be in possession of
> that quality, it does.
>
> On the surface, it is simple and you can interact with it without much
> further appreciation. The closer you study it and the deeper your
> understanding of it becomes, the more complex it becomes, even as you begin
> to understand that it is even simpler than you once appreciated.
>
> This is why, even though I have not had the good fortune to program in
> quite some time, I still follow this list. I appreciate Lua as something
> uniquely artful amongst the technological works that I've studied.

I wholeheartedly agree. My point was the relationship between
non-programmers and high-level concepts.

--
   Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Sean Conner
In reply to this post by Laurent FAILLIE
It was thus said that the Great Laurent FAILLIE once stated:
> Very interesting discussion, indeed :)

> When I started with Lua, I made a parallel with the BASIC (the one from
> 80', the real one, not VB with is far away vs original BASIC concept) :

  Even the version in the 80s wasn't the "real one"---the real one would be
BASIC from Dartmouth College in 1964.

> Lua syntax is simple and accessible (for basic tasks), learning curve is
> very fast and even non programmer can progress easily.

> But I faced rapidly 2 pitfalls :- the 1st one is strings manipulation :
> sooner, you need to master RegEx to do even simple tasks with strings and
> I think it's a showstopper for beginners.


> Lua is missing simple but
> powerful string manipulation functions as the Basic has.

  What?  All I recall of BASIC string manipulations are LEFT$(), RIGHT$(),
MID$() and STRING$(), all of which can be replaced with string.sub() in Lua.
I recall those being pretty typical of the time.

> Finally, I succeeded and I'm "proud" of results :
> https://github.com/destroyedlolo/Selene and
> https://github.com/destroyedlolo/Marcel which are matching my
> objectives.As you can see, I'm sticking with 5.1 ... because
> luaL_register() has been deprecated and I was unable to find a clear way
> to migrate code like 
>
> | static const struct luaL_reg SelSurfaceLib [] = { |
> |  {"BlittingFlagsConst", BlittingFlagsConst}, |
> | ... , |
> |  {"CircleQuarterConst", CircleQuarterConst}, |
> |  {"create", createsurface}, |
> |  {NULL, NULL} |
> | }; |
>
> | static const struct luaL_reg SelSurfaceM [] = { |
> |  {"Release", SurfaceRelease}, |
> |  {"destroy", SurfaceRelease}, /* Alias */ |
> | ... |
> |  {"restore", SurfaceRestore}, |
> |  {NULL, NULL} |
> | }; |

> | void _include_SelSurface( lua_State *L ){ |

         ^ Just a note---identifiers starting with a leading underscore are
reserved for the C compiler, not for user code.  That aside ...

> |  luaL_newmetatable(L, "SelSurface"); |
> |  lua_pushstring(L, "__index"); |
> |  lua_pushvalue(L, -2); |
> |  lua_settable(L, -3); /* metatable.__index = metatable */ |
> |  luaL_register(L, NULL, SelSurfaceM); |
> |  luaL_register(L,"SelSurface", SelSurfaceLib); |
> }
>
> to newer Lua :(

        void include_SelSurface(lua_State *L)
        {
          luaL_newmetatable(L,"SelSurface");
          lua_pushvalue(L,-1);
          lua_setfield(L,-2,"__index");
          luaL_setfuncs(L,SelSurfaceM,0);
          luaL_newlib(L,SelSurfaceLib);
          lua_setglobal(L,"SelSurface");
        }

  -spc


Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Hisham
On 17 March 2017 at 17:19, Sean Conner <[hidden email]> wrote:

> It was thus said that the Great Laurent FAILLIE once stated:
>> Very interesting discussion, indeed :)
>
>> When I started with Lua, I made a parallel with the BASIC (the one from
>> 80', the real one, not VB with is far away vs original BASIC concept) :
>
>   Even the version in the 80s wasn't the "real one"---the real one would be
> BASIC from Dartmouth College in 1964.
>
>> Lua syntax is simple and accessible (for basic tasks), learning curve is
>> very fast and even non programmer can progress easily.
>
>> But I faced rapidly 2 pitfalls :- the 1st one is strings manipulation :
>> sooner, you need to master RegEx to do even simple tasks with strings and
>> I think it's a showstopper for beginners.
>
>
>> Lua is missing simple but
>> powerful string manipulation functions as the Basic has.
>
>   What?  All I recall of BASIC string manipulations are LEFT$(), RIGHT$(),
> MID$() and STRING$(), all of which can be replaced with string.sub() in Lua.
> I recall those being pretty typical of the time.
>
>> Finally, I succeeded and I'm "proud" of results :
>> https://github.com/destroyedlolo/Selene and
>> https://github.com/destroyedlolo/Marcel which are matching my
>> objectives.As you can see, I'm sticking with 5.1 ... because
>> luaL_register() has been deprecated and I was unable to find a clear way
>> to migrate code like
>>
>> | static const struct luaL_reg SelSurfaceLib [] = { |
>> |  {"BlittingFlagsConst", BlittingFlagsConst}, |
>> | ... , |
>> |  {"CircleQuarterConst", CircleQuarterConst}, |
>> |  {"create", createsurface}, |
>> |  {NULL, NULL} |
>> | }; |
>>
>> | static const struct luaL_reg SelSurfaceM [] = { |
>> |  {"Release", SurfaceRelease}, |
>> |  {"destroy", SurfaceRelease}, /* Alias */ |
>> | ... |
>> |  {"restore", SurfaceRestore}, |
>> |  {NULL, NULL} |
>> | }; |
>
>> | void _include_SelSurface( lua_State *L ){ |
>
>          ^ Just a note---identifiers starting with a leading underscore are
> reserved for the C compiler, not for user code.  That aside ...
>
>> |  luaL_newmetatable(L, "SelSurface"); |
>> |  lua_pushstring(L, "__index"); |
>> |  lua_pushvalue(L, -2); |
>> |  lua_settable(L, -3); /* metatable.__index = metatable */ |
>> |  luaL_register(L, NULL, SelSurfaceM); |
>> |  luaL_register(L,"SelSurface", SelSurfaceLib); |
>> }
>>
>> to newer Lua :(
>
>         void include_SelSurface(lua_State *L)
>         {
>           luaL_newmetatable(L,"SelSurface");
>           lua_pushvalue(L,-1);
>           lua_setfield(L,-2,"__index");
>           luaL_setfuncs(L,SelSurfaceM,0);
>           luaL_newlib(L,SelSurfaceLib);
>           lua_setglobal(L,"SelSurface");
>         }

And if you're making a separate module to be used with require(), name
it luaopen_<module name>, compile it as a shared library, and avoid
creating a global:

void luaopen_SelSurface(lua_State *L)
{
   luaL_newmetatable(L,"SelSurface");
   lua_pushvalue(L,-1);
   lua_setfield(L,-2,"__index");
   luaL_setfuncs(L,SelSurfaceM,0);
   luaL_newlib(L,SelSurfaceLib);
   return 1
}

and then in Lua,

   local SelSurface = require("SelSurface")

-- Hisham

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Martin
In reply to this post by Sean Conner
On 03/17/2017 01:19 PM, Sean Conner wrote:
>> Lua is missing simple but
>> powerful string manipulation functions as the Basic has.
>
>   What?  All I recall of BASIC string manipulations are LEFT$(), RIGHT$(),
> MID$() and STRING$(), all of which can be replaced with string.sub() in Lua.
> I recall those being pretty typical of the time.

There are more.

LEFT$/RIGHT$/MID$ - get part of string
  ~ string.sub
MID$ - set part of string
  ~ string.gsub
LEN
  ~ string.len, # operator
LTRIM$/RTRIM$ - trim spaces
  ~ string.gsub
LCASE$/UCASE$
  ~ string.(lower/upper)
INSTR - find substring
  ~ string.find
STR$/VAL/HEX$/OCT$
  ~ tonumber/tostring
ASC/CHR$
  ~ string.(char/byte)
STRING$/SPACE$ - repeat one char <n> times,
  ~ string.rep
MKI$/CVI/... - codecs to internal number formats (int, dbl, float, ...)
  ~ string.(pack/unpack)

Generally I feel Lua functions more generic, more powerful and
harder to master.

Surely they are completely different languages. Lua is a more
language itself, with central abstractions on tables, first-type
functions and variable code. While QBASIC is a fixed interface to
hardware that was available at that time. Lua is good for processing
complex data structures while QBASIC is good for implementing UI.

(BTW for Lua is a nice library Love2D which affords similar
functionality as QBASIC - almost direct access to hardware without
predefined UI elements.)

(And I think that niche for data processing are still almost empty.
Only regexps are there. (And probably map/reduce.))

(Yes, we can do anything with C/Go/Pascal/Ada/.. but sometimes
marginal simplicity and narrower application field are needed to
implement complex things.)

-- Martin

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

Coda Highland
On Sat, Mar 18, 2017 at 3:49 AM, Martin <[hidden email]> wrote:

> On 03/17/2017 01:19 PM, Sean Conner wrote:
>>> Lua is missing simple but
>>> powerful string manipulation functions as the Basic has.
>>
>>   What?  All I recall of BASIC string manipulations are LEFT$(), RIGHT$(),
>> MID$() and STRING$(), all of which can be replaced with string.sub() in Lua.
>> I recall those being pretty typical of the time.
>
> There are more.
>
> LEFT$/RIGHT$/MID$ - get part of string
>   ~ string.sub
> MID$ - set part of string
>   ~ string.gsub
> LEN
>   ~ string.len, # operator
> LTRIM$/RTRIM$ - trim spaces
>   ~ string.gsub
> LCASE$/UCASE$
>   ~ string.(lower/upper)
> INSTR - find substring
>   ~ string.find
> STR$/VAL/HEX$/OCT$
>   ~ tonumber/tostring
> ASC/CHR$
>   ~ string.(char/byte)
> STRING$/SPACE$ - repeat one char <n> times,
>   ~ string.rep
> MKI$/CVI/... - codecs to internal number formats (int, dbl, float, ...)
>   ~ string.(pack/unpack)
>
> Generally I feel Lua functions more generic, more powerful and
> harder to master.
>
> Surely they are completely different languages. Lua is a more
> language itself, with central abstractions on tables, first-type
> functions and variable code. While QBASIC is a fixed interface to
> hardware that was available at that time. Lua is good for processing
> complex data structures while QBASIC is good for implementing UI.
>
> (BTW for Lua is a nice library Love2D which affords similar
> functionality as QBASIC - almost direct access to hardware without
> predefined UI elements.)
>
> (And I think that niche for data processing are still almost empty.
> Only regexps are there. (And probably map/reduce.))
>
> (Yes, we can do anything with C/Go/Pascal/Ada/.. but sometimes
> marginal simplicity and narrower application field are needed to
> implement complex things.)
>
> -- Martin
>

Most of those functions aren't present in traditional BASIC
implementations. The trim, case, find, and packing functions are
certainly not present.

/s/ Adam

Reply | Threaded
Open this post in threaded view
|

Re: Re Atari BASIC versis Python versus Lua in 1982...

steve donovan
In reply to this post by Enrico Colombini
On Fri, Mar 17, 2017 at 10:44 AM, Enrico Colombini <[hidden email]> wrote:
> BASIC could be reasonably understood by non-programmers, so many people
> wrote programs in their domain of expertise. They were unrefined and naive
> programs, but they often worked fine because the authors knew their trade
> well.

This does continue - I've dealt with domain experts that live in Excel
and can speak VBA.

> Today's languages require professional programmers... and we often have
> communication problems between the subject expert and the technical expert.

Oh yes. I remember inheriting a Java app. implementing the intricate
spreadsheets of such an expert. And ended up thinking - if we both had
Lua in common, then life would _definitely_ be easier, because I was
round-tripping between Java and Basic a lot.

Reply | Threaded
Open this post in threaded view
|

Migrating function to newer Lua (Re Atari BASIC versis Python versus Lua in 1982...)

Laurent FAILLIE
In reply to this post by Hisham
Thanks both of you for these valuable inputs :)



>> |  luaL_newmetatable(L, "SelSurface"); |
>> |  lua_pushstring(L, "__index"); |
>> |  lua_pushvalue(L, -2); |
>> |  lua_settable(L, -3); /* metatable.__index = metatable */ |
>> |  luaL_register(L, NULL, SelSurfaceM); |
>> |  luaL_register(L,"SelSurface", SelSurfaceLib); |
>> }
>>
>> to newer Lua :(
>
>        void include_SelSurface(lua_State *L)
>        {
>          luaL_newmetatable(L,"SelSurface");
>          lua_pushvalue(L,-1);
>          lua_setfield(L,-2,"__index");
>          luaL_setfuncs(L,SelSurfaceM,0);
>          luaL_newlib(L,SelSurfaceLib);
>          lua_setglobal(L,"SelSurface");
>        }

If I'm not making a mistake, this syntaxe is working starting Lua 5.2 and is not reconize by Lua 5.1 ? (it's make my code compatible with as large as possible Lua version).

> And if you're making a separate module to be used with require(), name
> it luaopen_<module name>, compile it as a shared library, and avoid
> creating a global:
>
> void luaopen_SelSurface(lua_State *L)
> {

>  luaL_newmetatable(L,"SelSurface");
>  lua_pushvalue(L,-1);
>  lua_setfield(L,-2,"__index");
>  luaL_setfuncs(L,SelSurfaceM,0);
>  luaL_newlib(L,SelSurfaceLib);
>
>  return 1
> }
>
> and then in Lua,
>
> local SelSurface = require("SelSurface")

In fact, the concept is to have Lua embedded in Séléné (like it is in Conky) which makes easier (for me :) ) internal dependencies management and it's consistent with my other project (Marcel) where Lua is "only" an enduser helper.
Anyway, I keep this in mind for other project more Lua centric.

Nice W.E.

Laurent