Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Fri May 03, 2019 7:30 pm

ScriptBasic,
It's time to get off the bus if programming is no longer enjoyable and you have become a slave.
That is conflating two very different things: the joy of programming and being a slave.

I don't think I said that programming, like many sins, is not enjoyable. Which is probably why I spent an inordinate amount of time tinkering with the fibo and big multiplication problem here. It's probably why I spend my free time recently getting to grips with Verilog and Scala to produce my own RISC V processor implementation for FPGA. And so on.

As for the "slave" thing, my career in computing did not lead to the fame and fortune of a race car driver. However my skills as a software dump truck driver got me into all kind of interesting places, meeting all kind of wonderful people, all around the world. The likes of which I would never imagined possible as a kid.

I think I hopped off the bus a few years back. It's rare that someone approaches me with a software project I even think is worthwhile doing anymore, let alone interesting to do.

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Fri May 03, 2019 8:05 pm

We could use the help with the ScriptBasic project if that type of programming interest you. Creating extension modules is fun and rewarding.

I'm going to be demonstrating the IUP extension module here shortly. (see example on the Other programming languages board)

User avatar
scruss
Posts: 2224
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 12:32 am

Heater wrote:
Fri May 03, 2019 6:23 pm

In the office where there is no sun
I will never forgive Oracle for what they did to that company …

In more (or less) sensible news, I just found the Concatenative language wiki. I remember trying to program in Factor a few years back. I felt a bit like Slartibartfast trying to learn to play the octaventral heebiephone …
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

timrowledge
Posts: 1256
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 12:52 am

Apropos of a few loose neds -
- whilst spending a couple of hours with my Astro Pi Case colleague, packaging up kits, we were talking about a talk I gave recently on the home automation field, which lead on to discussions about programming such stuff. He's a machinist (pretty high-end too - made parts for the James Cameron 'Mariana Trench' submersible etc) but not at all a software enginerer (duh). He had however recently stumbled across some web articles that mentioned Smalltalk and its syntax; his immediate opinion was basically "Oh, yeah, that looked really easy to understand and use" . Just a bit of random anecdata.
- As a result of trying to make the fibonacci cal go faster, we've now generically improved the speed of handling colossal numbers in Squeak by about an order of magnitude. That will all go into the next release and benefit users in the future. So thank you for that.
- As a sop to the original subject and just to nose-tweak the idea of 'depending on other languages' a little, I'll point out that Liberty BASIC is implemented in Squeak Smalltalk [https://en.wikipedia.org/wiki/Liberty_BASIC] ;)

{and I was going to correct the spelling but seriously, isn't "a few loose neds" better than loose ends?}
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 1:15 am

- As a sop to the original subject and just to nose-tweak the idea of 'depending on other languages' a little, I'll point out that Liberty BASIC is implemented in Squeak Smalltalk https://en.wikipedia.org/wiki/Liberty_BASIC
Ya never know what's under the covers till the lights go out. :o

I would like to see Python uncoiled and expose the emulations like threading. Creating C extension for Python also seems overwhelming.

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 2:14 am

Tim,

I can't help but hear a loud tone of sarcasm when I read "Oh, yeah, that looked really easy to understand and use" :)
As a result of trying to make the fibonacci cal go faster, we've now generically improved the speed of handling colossal numbers in Squeak by about an order of magnitude.
That's great. Good to know something useful came out of all this.

LibertyBASIC, being closed source and Windows only is about as useful as a barnacle and it may as well be written in Klingon. Also why is it called "LibertyBASIC" when it is not free software let alone Free Software, there is nothing libre about it?

I always have a few loose neds in the bottom of my toolbox.

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 2:23 am

Trying to get anyone to use a closed source commercial BASIC is going to be a hard sell. I think Richard discovered that realization with BBC BASIC.

I feel ScriptBasic has its greatest potential on products like the Raspberry Pi.

User avatar
scruss
Posts: 2224
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:10 am

Heater wrote:
Sat May 04, 2019 2:14 am
… LibertyBASIC, being closed source and Windows only …
It runs on the Raspberry Pi: viewtopic.php?p=1457864
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

hippy
Posts: 5105
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:58 am

ScriptBasic wrote:
Sat May 04, 2019 1:15 am
Creating C extension for Python also seems overwhelming.
They are really easy when it comes down to it. It all looks a bit overwhelming at first but it's quite simple and rather elegant.

There is a certain amount of fluff needed to keep Python happy, in detailing what the extension is and the methods exposed but that's really just to tie things together. It's all just boilerplate.

Then, for everything exposed to Python, there's an interface routine written in C which takes Python things passed to it, wrangles them into C things. Those are passed to a standard C function and one gets some C things back. Those are wrangled back into Python things. And the routine exits. Job done.

That C can be in-line, within the interface, but it's cleaner to separate the Python-to-C-and-back-to-Python interface, from the actual C code. That also allows one to take any C code and generate a Python interface automatically for it, or to specify what the Python interface will look like and generate both the interface and C skeleton from that.

The to and from Python wrangling is all handled by macros and routines provided for by including <python.h> so there's little do do except learn how they work and how to handle error conditions, plus how to wrap the fluff around it.

Python 2 and Python 3 extensions are slightly different, and MicroPython is different again, but it's not that hard to create code which works for all three.

Here's a simple, self-contained and complete, extension, for Python 2 and 3 though I've not tried building it, created from a single "int add(int a, int b) Add two numbers together" line in a definition file. It doesn't follow all the recommended standards but, meh, it works for me -

Code: Select all

// ***************************************************************************
// *                                                                         *
// *  A DUMMY test module                                                    *
// *                                                                         *
// ***************************************************************************

#include <Python.h>

#define PRODUCT "A DUMMY test module"
#define PACKAGE "DUMMY"
#define OPTIONS "Monolithic, Python 2, Python 3"
#define LICENSE "MIT"
#define VERSION "0.00"
#define RELEASE "0001"
#define TOUCHED "2019-05-04 04:44:04"

// .-------------------------------------------------------------------------.
// |  Determine Python version being used                                    |
// `-------------------------------------------------------------------------'

#ifdef PY_MAJOR_VERSION
  #if PY_MAJOR_VERSION <= 2
    #define PYTHON2
  #else
    #define PYTHON3
  #endif
#endif

// .-------------------------------------------------------------------------.
// |  Define the extension's docstrings for the Python interface             |
// `-------------------------------------------------------------------------'

static char docstring[]              = "A DUMMY test module";
static char docstring_add[]          = "Add two integers";

// .-------------------------------------------------------------------------.
// |  Define the methods exposed to Python                                   |
// `-------------------------------------------------------------------------'

static PyObject *DUMMY_add           (PyObject *self, PyObject *args);

// .-------------------------------------------------------------------------.
// |  Expose the methods to Python                                           |
// `-------------------------------------------------------------------------'

static PyMethodDef methods[] =
{
  { "add",          DUMMY_add,          METH_VARARGS, docstring_add          },
  { NULL,           NULL,               0,            NULL                   }
};

// .-------------------------------------------------------------------------.
// |  Define the native C functions used within this extension               |
// `-------------------------------------------------------------------------'

int    add(int a, int b);

// ***************************************************************************
// *                                                                         *
// *  Implement the extension's interface to Python                          *
// *                                                                         *
// ***************************************************************************

#ifdef PYTHON2

  PyMODINIT_FUNC initDUMMY(void)
  {
    PyObject *m = Py_InitModule3("DUMMY", methods, docstring);
  }

#endif

#ifdef PYTHON3

  static struct PyModuleDef definition =
  {
     PyModuleDef_HEAD_INIT, "DUMMY", docstring, -1, methods
  };

  PyMODINIT_FUNC PyInit_DUMMY(void)
  {
    Py_Initialize();
    PyObject *m = PyModule_Create(&definition);
    if (m == NULL)
      return NULL;
    return m;
  }

#endif

// .-------------------------------------------------------------------------.
// |  Fixups for Python 3                                                    |
// `-------------------------------------------------------------------------'

#ifdef PYTHON3

  #define PyInt_AsLong

#endif

// .-------------------------------------------------------------------------.
// |  int = DUMMY.add(a, b)                                                  |
// |-------------------------------------------------------------------------|
// |  Add two integers                                                       |
// `-------------------------------------------------------------------------'

static PyObject *DUMMY_add(PyObject *self, PyObject *args)
{ //             DUMMY.add(a, b)
  int a;
  int b;
  if (!PyArg_ParseTuple(args, "ii", &a, &b))
    return NULL;
  PyObject *pythonInt = Py_BuildValue("i", add(a, b));
  return pythonInt;
}

// ***************************************************************************
// *                                                                         *
// *  Native C functionality                                                 *
// *                                                                         *
// ***************************************************************************

// .-------------------------------------------------------------------------.
// |  int = add(a, b)                                                        |
// |-------------------------------------------------------------------------|
// |  Add two integers                                                       |
// `-------------------------------------------------------------------------'

int add(int a, int b)
{
  // -- TO DO - Added by CREATE
  return 0;
}

// ***************************************************************************
// *                                                                         *
// *  End of DUMMY extension                                                 *
// *                                                                         *
// ***************************************************************************

ejolson
Posts: 2863
Joined: Tue Mar 18, 2014 11:47 am

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 4:08 am

hippy wrote:
Sat May 04, 2019 3:58 am
Here's a simple, self-contained and complete, extension, for Python 2 and 3 though I've not tried building it, created from a single "int add(int a, int b) Add two numbers together" line in a definition file. It doesn't follow all the recommended standards but, meh, it works for me -
Did you make those comment boxes out of asterisks and hyphens or is that something the editor does automatically?

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 8:49 am

scruss,
It runs on the Raspberry Pi: viewtopic.php?p=1457864
Interesting. Mac and PC Linux as well apparently.

I'll revise my statement then:

LibertyBASIC, being closed source and non-free is about as useful as a barnacle and it may as well be written in Klingon.

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 8:59 am

hippy,
I quite like RPN.
I was into it back in the days of RPN calculators.
I also think that, if a programming language is going to use RPN, it should be consistent in always being RPN in it's syntax and control structures. But that's very difficult to do and it always seems to end up half-RPN and a complete mess.
I'm no expert but I thought the Forth language was RPN through and through. Having debated with Forth proponents they say it is very easy to do. For example things like Tachyon Forth for the Parallax Propeller, a complete interactive Forth system in 32K of RAM with space to spare.

It's just that having to write whole programs that way gives me worse migraines than Scheme.
On the plus side, whenever someone had appropriated my Sinclair Scientific calculator at school, it always got returned.
True dat. Those were the days. Thanks Clive.

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 10:03 am

Tim,

A while back you questioned my use of the term "headless" when I described wanting to use Smalltalk/Squeak with a screen. Which does sound self contrary.

What I had in mind was a headless Linux system which one communes with over SSH say. No X Windows or display required to use the OS.

But, this system would happen to have a display attached for use by an application. Full screen into the frame buffer and hopefully supporting gl. Perhaps just a small screen. This would be a GUI for that application only. Perhaps a control interface for some machine with touch control or a few real buttons.

I have made this kind of thing on the Pi using C++ and Qt 5 rendering to the frame buffer. Hardware accelerated 3D and all.

Given the purported ease with which object oriented graphical things can be created in Smalltalk/Squeak being able to do the above in Squeak would tempt me to investigate further.

jalih
Posts: 29
Joined: Mon Apr 15, 2019 3:54 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 11:23 am

Heater wrote:
Sat May 04, 2019 8:49 am
I'll revise my statement then:

LibertyBASIC, being closed source and non-free is about as useful as a barnacle and it may as well be written in Klingon.
Why is that? Why not pay some money for a good product and support the developer? Why does everything need to be free or open source?

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 12:55 pm

jalih.
Why is that? Why not pay some money for a good product and support the developer? Why does everything need to be free or open source?
A good question. Here is my take on it:

1) Price. $59 dollars can buy more than 10 beers around here!

2) Alternatives. We have so many high quality, cross-platform, well supported, Free and Open Source alternatives.

3) Sustainability. Over the past decades I have seen plenty of projects become unsustainable because tools they used became unavailable or were not available for some new OS or platform. Perhaps the vendor goes away. Perhaps they stop development and support. Poof! Huge amounts of time, money and effort suddenly become useless.

See the end of Eltech's ExaGear or the slow death of FLASH for recent examples.

There have been many more over the course of computing history. Back in the day many used Intel's PL/M language on their microprocessor projects. Which Intel dropped a long time ago and never provided for their newer processors anyway.

4) Collaboration. If there are bugs in the product people can't fix them. If they have enhancements people can't do anything. I'm unlikely to be able to fix compiler/interpreter bugs anyway but I'm loath to even spend time creating bug reports for commercial projects. That's working for someone else for free. I'd rather donate my time to the community of an open source project.

5) Security. We don't know what goes on in a closed source binary only executables.

6) Transparency. Sometimes one want to "open the hood" and see how something is put together. Perhaps just to learn something. Perhaps to see how it can be fixed/extended/ported. All kind of reasons.

7) Community. When I publish code openly I'd like it to be usable by as many people as possible. Better that it is not required for them to also spend money to make use of it. Better they don't have to have the same platform as the me. Better that it does not impart to them all the disadvantages of close source systems listed above. I have no significant Open Source projects but there are people who have been grateful for my little demos, examples, and so on.

8) Licensing. Often closed source products have very restrictive conditions about how and where their code can be used.

I could go on...

Some of the above may seem may seem fanatically philosophical or even religious. Some crazy people see it as "communist". I don't. Most of the reasons I give have very practical and economic reasons for being. The actual monetary price of a copy is not even the main point.

I think you are conflating some separate issues in your question. The "free" in Free and Open Source software does not imply free of cost. It does not imply developers don't get paid. Likely most Open Source software is developed by employed professionals getting paid by the likes of RedHat, IBM, Apple, Microsoft, Google, Facebook, and countless others. Companies have realized that an open development community for tools they use is a good thing, they pool their efforts and expense.

Anyway, it's up to you. It's not my concern what you pay for and use. I have no problem with lone developers attempting to monetize their efforts. I only point out the potential problems for you.

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 1:33 pm

I believe the days of paying for an OS or programming language have passed. A good example is PowerBasic. When the author died so did the language putting users in a crisis.

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 2:53 pm

PowerBasic is perhaps a fine example of some of what I was talking about.

Having never heard of PowerBasic I did a quick google...

Luckily it has a new owner. Who is happy to take $100 a pop off the remaining helpless, dependent users. Despite not having progressed the project in 8 years !

Of course most of the worlds computer users pay for their operating systems. Over and over again. Every time they purchase a PC or Mac.

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:05 pm

PowerBasic started off as a 16 bit QuickBasic competitor and patched the compiler along the way to produce 32 bit executables. The author ripped off key 3rd party vendors as well. The BASIC was sold to Drake (PB user) in a fire sale after Zales death.. The only person able to compile a build is rotting in the ground.

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:19 pm

Wow, according to a post here: http://www.thinbasic.com/community/arch ... 12736.html PowerBasic consists of 400,000 lines of assembler code.

I'll wager no one is stepping up to develop that code base further.

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:26 pm

Investing in a (emulated) 32 bit Windows only BASIC that no one other than the author could build is nuts.

PowerBasic has become the poster child for why open source is the future.

jahboater
Posts: 4180
Joined: Wed Feb 04, 2015 6:38 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:38 pm

ScriptBasic wrote:
Sat May 04, 2019 3:26 pm
PowerBasic has become the poster child for why open source is the future.
Yes indeed.

Well,I have far far more powerful languages on my Pi's and my PC all for free:-

D, C++17, Fortran 2018, C18, etc. All highly capable and very fast!

They are good enough for me ...

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:47 pm

I was thinking about starting a thread on the https://RaspberryBASIC.org forum on how to build a ScriptBasic extension module in C or C BASIC. Is there any interest from the community here or would I be wasting my time?

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 3:58 pm

jahboater wrote:
Sat May 04, 2019 3:38 pm
ScriptBasic wrote:
Sat May 04, 2019 3:26 pm
PowerBasic has become the poster child for why open source is the future.
Yes indeed.

Well,I have far far more powerful languages on my Pi's and my PC all for free:-

D, C++17, Fortran 2018, C18, etc. All highly capable and very fast!

They are good enough for me ...
gcc is my default C compiler on all platforms ScriptBasic runs on. I love the macro / pre-processor ability.

Heater
Posts: 12111
Joined: Tue Jul 17, 2012 3:02 pm

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 4:00 pm

I liken open source software to human neighborhoods.

Open Source - A nice neighborhood where everyone owns their own home. As a consequence they take care of their garden, planting flowers and so on, to make the place look nice. They won't tolerate any junk lying around that lowers the tone of the neighborhood. They take care of the condition of their property. They watch out for each others security with neighborhood watch schemes etc. They help each other out building sheds and such. They attend local planning meetings to be part of what direction the place moves in the future.

Closed Source - A neighborhood where everyone rents the place they live in. They have no stake in keeping up appearances or maintaining the property, the place is an ugly mess and it eventually rots and collapses or gets bulldozed. They don't know each other so security goes out the Window. They can be evicted at any time.

Of course Open Source projects are human communities. Of developers and users. Could be individuals could be corporations. They all benefit from ownership of their own repositories whilst helping maintain others.

User avatar
ScriptBasic
Posts: 909
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: Why Avoid BASIC on RPi?

Sat May 04, 2019 4:02 pm

Sharing with greed left at the door is how it's supposed to work.

Return to “Off topic discussion”