User avatar
davidcoton
Posts: 4124
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 9:54 am

ejolson wrote:
Sat Apr 13, 2019 7:13 am
Fortran Man and the Fibonacci Code
+1.0 :lol: :D
Signature retired

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

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 9:58 am

Oh yes. To gain any traction in the Pi world a language system needs to have support for GPIO, SPI, I2C, serial ports, etc, easily available and easy to use. Preferably out of the box.

That is way more important than 64 bit support which most people don't have and don't need.
Thanks for validating my next step with SciptBasic on the RPi.

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

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 10:08 am

ScriptBasic wrote:
Sat Apr 13, 2019 9:52 am
RPi = Raspberry Python Interpeter

Who would of guessed?
and 3.14 of course.

User avatar
davidcoton
Posts: 4124
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 10:20 am

Heater wrote:
Sat Apr 13, 2019 9:49 am
Now, all the world and his dog is jumping on Python. I find it very disturbing.
I'm sure the python finds it disturbing, too.
But surely after 66 full pages of this thread the one clear truth is that (almost?) all programming languages have their strengths and weaknesses. The perfect language will probably never be specified.

As to practical choice, unless there are particular specialist aspects to a project that would point to a specialist minority language, most of us will do better with a language we know rather than learning a new one. But that runs against the Pi educational ethos -- having so many languages available for free should encourage us to explore. (TODO: Forth, D, Javascript, Smalltalk, Lisp, Snobol, List here!)

For first time programmers, I'm still undecided about that. Python or Basic? One designed as a full-feature language, one designed as a minimal (but since explodedexpanded) easy-to-master system. It was possible to have a programming career in Basic, but knowing Python is probably more useful professionally now. In any case, most (not all) hard core software engineering will continue to be C/C++ or its derivates for the next decade or more, and C++ is probably not a good choice as a first language.

Now, how do I fit 28 hours into each day?
Signature retired

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

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 10:43 am

The perfect language will probably never be specified. 
ScriptBasic is as close as I have found to achieving that goal

* Written in ANSI C and runs on everything.

* Embeddable by design with an unlimited expansion API

* Based on a traditional BASIC syntax with sprinkles of Python and Perl mixed in for good measure.

* Open source with multipal contributing seasoned developers that have been around for awhile.

User avatar
Gavinmc42
Posts: 3718
Joined: Wed Aug 28, 2013 3:31 am

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 11:52 am

I'm curious why JavaScript isn't more popular on the RPi than Python? Is there some special relationship the Raspberry Pi foundation has with Python that everything seems based on it?
JS and NodeJS are getting used on Pi's.
I tried NodeJS but the NPM system I could not use behind a Uni firewall.

For me a language that does not need dependencies that have to be downloaded and installed is a prerequisite.
It is why i don't use C/C++ much either.
Python needs pygame, numpy etc to be useful.
Some stuff can be manually downloaded and Firezilla across to the Pi.
I did this with PiCore and just the few files extra it needed.
I had to learn how to do live webpages with shell, awk and sed ;)

Languages that require the internet are not much use to me.
Self contained is important.
That said, I feel my time would best spent getting a decent GPIO extension module built for SciptBasic on the RPi. My thoughts at this time is using the pigpio C library as it's base.
Yep Joan's stuff is a good place to start.
I suspect if you dig deep enough this has pigpio under it
https://gpiozero.readthedocs.io/en/stable/

Rats got distracted, where is that SB install link?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 1:42 pm

Gavinmc42,
I tried NodeJS but the NPM system I could not use behind a Uni firewall.
What is that about? Pretty much everything can make use of access to the net. Be it a Raspi OS upgrade or Python's module system PIP. Are they really blocking NPM? Why?
For me a language that does not need dependencies that have to be downloaded and installed is a prerequisite.
Node and Javascript are no different to any other language in that respect. You can do anything with an out of the box node.js installation, as you can with C/C++ or any other language.

Of course if you want to make use of other peoples libraries/modules you have to get them from somewhere. Node.js does not actually need NPM to do that.
Languages that require the internet are not much use to me. Self contained is important.
I don't know any languages that require internet. I also don't know any language installs that contain everything you may ever need.

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

Re: Why Avoid BASIC on RPi?

Sat Apr 13, 2019 3:20 pm

Heater wrote:
Sat Apr 13, 2019 1:42 pm
I don't know any languages that require internet. I also don't know any language installs that contain everything you may ever need.
I think Scratch 3 running on the Raspberry Pi requires internet. It also contains everything anyone would ever need, including an orange cat.

I wonder whether Scratch 4 will be written in Python or Basic. Pondering the next version of Scratch, of course, begs the question, why avoid JavaScript?

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 1:47 am

of course, begs the question, why avoid JavaScript?
I'm not sure if this has already been posted or not but here is the JavaScript / Node version of Fibonacci on my RPi 3 B.

Code: Select all

function fibonacci(n) {
  if (n <= 2) {
    return 1;
  } else {
    return fibonacci(n - 1) + fibonacci(n - 2);
  }
}
 
console.log(fibonacci(24));
[email protected]:~/sbrpi/examples $ time node fibonacci.js
46368

real 0m2.377s
user 0m2.319s
sys 0m0.060s
[email protected]:~/sbrpi/examples $

It seems to me that ScriptBasic is the fastest to load and execute if you exclude C (parent language) and Python in disk cache.

What is interesting to see is using the SBT extension module where ScriptBasic runs ScriptBasic using libscriba.so for it's interpreter in an asynchronous or synchronous thread.

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 7:58 am

But this Javascript fibonacci does fibo(4784969)
https://github.com/ZiCog/fibo_4784969/b ... pt/fibo.js

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 5:47 pm

Here is a good article about the early days of Java, Python, Perl and TypeScript form the authors.

https://thenewstack.io/a-conversation-w ... -and-perl/

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 5:57 pm

Admittedly not many people need million digit Fibonacci numbers very often. However there are practical uses for big integers.

As I think I have said before the fibo(4784969) challenge is not really about big Fibonacci numbers. It's about comparing source code clarity, expressiveness, ease of development, with a nod to performance. The big fibo is just a simple to specify problem for that goal that does not require huge amounts of code or development time that would discourage people from contending.

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 8:53 pm

ScriptBasic wrote:
Sun Apr 14, 2019 5:15 pm
Can you give me an example where fibo(4784969) demonstrates a practical use
There are lots of things people do with computers that are motivated by considerations other than practicality.

The support of impractical computing was part of the revolution pioneered at Dartmouth where access to Basic was provided to everyone without the requirement of a grant-like research proposal explaining the need for computer time. Rather than placing limits, Kemeny and Kurtz encouraged students to create and play games.

Relaxing the requirement that every program be practical was likely as important as Basic itself in creating a learning atmosphere where computer literacy could flourish. This, in turn, led to a golden age of personal computing and a greater ability to read and write computer programs than we have today among college-bound students interested in computer science.

During the digital darkness that led up to the introduction of the Pi, the personnel computer became synonymous with office computer. Focus returned only to what is practical. Even computer games had become commercial products created by large companies using formulaic business methods. Programming in Basic was removed from school curricula. Computer literacy no longer referred to reading and writing code, but instead was word processing, spreadsheets, email, web browsing and practical secretarial skills.

While many half-baked ideas were formulated, finally a fully-baked idea was produced: The Raspberry Pi--a real computer designed for learning, making, experimentation and fun.

To avoid a digital apocalypse in which human decision makers are replaced by emotional neural networks, it is necessary, in my opinion, to understand how essential it is the freedom to practice impractical computing.
Last edited by ejolson on Sun Apr 14, 2019 9:41 pm, edited 14 times in total.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23631
Joined: Sat Jul 30, 2011 7:41 pm

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 8:58 pm

bensimmo wrote:
Sat Apr 13, 2019 9:32 am
Special?
The Pi in RaspberryPi is for Python.

Mainly as the choice of language that school children would be using.
It is/(was and even more so) the go to beginners text only language.
TBH not strictly true. I suppose Pi could in a small way relate to Python, but there are other reasons.

RPI does not stand for Raspberry Python Interpreter.

The RPF(T) do not use Python, excpet individuals writing quick tools. It's all almost al C, some C+ internal stuff.

As a teaching language though, Python is good enough for our purposes, although I detest the requirements for indentation.

Of course, the Pi supports almost every language known to man, simply choose the right one for the job.


Oh, and if this turns in to any more of a flame war over languages, I'll shut the thread. Deleted one post so far with bad language. This is a CHILD FRIENDLY forum.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 9:03 pm

jamesh wrote:
Sun Apr 14, 2019 8:58 pm
Deleted one post so far with bad language. This is a CHILD FRIENDLY forum.
Thanks.

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

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 10:09 pm

jamesh wrote:
Sun Apr 14, 2019 8:58 pm
bensimmo wrote:
Sat Apr 13, 2019 9:32 am
Special?
The Pi in RaspberryPi is for Python.

Mainly as the choice of language that school children would be using.
It is/(was and even more so) the go to beginners text only language.
TBH not strictly true. I suppose Pi could in a small way relate to Python, but there are other reasons.
True. As Eben himself put it; "Pi is because originally we were going to produce a computer that could only really run Python. So the Pi in there is for Python".

https://www.raspberrypi.org/magpi/happy ... and-python

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12212
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Why Avoid BASIC on RPi?

Sun Apr 14, 2019 10:55 pm

please keep it nice, we all have our preferences, so here is mine...

Although the RPI undoubtfully has part of its naming to thank Pyton for, I don't think for a moment, it was only (or primarily) designed to run it, its just a somewhat more modern replacement for BASIC, although needing a much stronger 16- or 32-bit computer than BASIC needed.

but I do think there is a place for BASIC, it a language intended for beginners, it normally interpreted so slow, but that increases interactivity compared to a compiled language.

But I think it has gotten a bad reputation, as the default language of many cheap homecomputers, ones that had a version of BASIC that required line numbers, and relied heavily on GOTO's without much structure. But even moderately modern variants are not likely to produce spaghetti code, and warp peoples minds, no matter what Edsger Dijkstra said. He wasn't talking about any modern dialect of BASIC, but on the unstructured versions with line numbers, and GOTO's, like the 4K level 1 microsoft BASICs of his time and the original Dartmouth BASIC, by the way he critiqued many other languages like Pascal and Fortran just as harshly. its just that what he said about BASIC rang a bell for many people who tried to struggle with a Microsoft variant of the language.


But especially the versions of BASIC created by Acorn are nice. Even the first incarnation for the Acorn Atom was a relieve compared to 8K microsoft BASICS of their contemporaries, like Commodores ridiculous C64 basic. It is clear that Jack Tramiel didn't like his customers to learn to program, just to consume software (games mostly) or he would have invested some money in getting a better BASIC than the primitive one he bought for the Commodore PET, and kept on using, because to do otherwise meant he had to spent money.

I'm not sure a version of BASIC primary intended for shell scripts is the best choice, (sorry script basic!) :roll: give us something like BBC Basic, that fits a fine on an RPI as Python, and can be similarly easy to use and I can be as expressive as any other language.

BASIC is (should be) forever....

I'm sorry for deleting post, I'm trying to keep the good will going, I can't do that with people getting carried away by anger....

User avatar
Gavinmc42
Posts: 3718
Joined: Wed Aug 28, 2013 3:31 am

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 2:59 am

With all the choices of Languages to run on Pi's and the number of people doing all sorts of things, I'm not sure why there is a debate about languages.

Is there a Python without whitespace?
If not, why not? :lol:

Pi's generally run languages on top of Linux.
If you did baremetal what language would you use?
So far on Pi's it is more than about a half dozen, C, C++, Rust, D, Pascal, Assembler, Python.
Why not a Basic too.

For standalone computers in the old days it was a simple OS with Basic.
That's where most of us oldies started. It worked back then to teach us, it should still work now.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 3:54 am

hippy,
As Eben himself put it; "Pi is because originally we were going to produce a computer that could only really run Python."
I have always wondered about that since I read similar years ago.

As far as I can tell the original Pi experiments were using some little ATMEL processor. Also as far as I can tell that predates MicroPython and there isn't a Python for such devices. So where was this Python to come from? Did Eben write his own Python for it? Was it actually a bigger ATMEL like the ARM based ones?

It would be great to see those early schematics. We could build our own retro "Pi 0" or "Pi -1".

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

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 3:56 am

Gavinmc42 wrote:
Mon Apr 15, 2019 2:59 am

If you did baremetal what language would you use?
So far on Pi's it is more than about a half dozen, C, C++, Rust, D, Pascal, Assembler, Python.
Why not a Basic too.
Because you need an interpreter and all sorts of other dependencies I suppose.
For C you have options like this (for the GCC):

Code: Select all

   -ffreestanding
       Assert that compilation targets a freestanding environment.  This implies
       -fno-builtin.  A freestanding environment is one in which the standard library may not
       exist, and program startup may not necessarily be at "main".  The most obvious example
       is an OS kernel.  This is equivalent to -fno-hosted.

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

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 5:25 am

jahboater wrote:
Mon Apr 15, 2019 3:56 am
Gavinmc42 wrote:
Mon Apr 15, 2019 2:59 am
If you did baremetal what language would you use?
So far on Pi's it is more than about a half dozen, C, C++, Rust, D, Pascal, Assembler, Python.
Why not a Basic too.
Because you need an interpreter and all sorts of other dependencies I suppose.
It would be somewhat amusing for a Pi to boot directly into BASIC like the bare-metal implementations of the past: PET, Sinclair, Apple II, BBC Micro, TRS-80 and even the original IBM PC.

Bare metal on the Pi seems most practical for hard real-time tasks. While interpreted BASIC may not be a good match for guaranteed maximum latencies, learning and fun are often higher priority than practical. In particular, there is definitely value in creating a bare-metal programming environment on the Pi, perhaps based on Basic, which is simple enough that a single person could create it and many people understand how it works.

Frustration with how complicated Linux, systemd and the GNU toolchain have become is likely one of the original motivations for this thread. Simplicity was also the idea behind Temple OS which, in my opinion, would be a very sensible learning environment to port and support on the Raspberry Pi. On the other hand, from a world domination point of view, it is quite empowering for children to have an opportunity to learn the same Linux operating system used by supercomputers, clouds and refrigerators.

User avatar
PeterO
Posts: 5003
Joined: Sun Jul 22, 2012 4:14 pm

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 7:00 am

ejolson wrote:
Mon Apr 15, 2019 5:25 am
Frustration with how complicated Linux, systemd and the GNU toolchain have become is likely one of the original motivations for this thread.
But lets not fool ourselves, the types of people posting to this thread are not the originally intended target audience for the Pi. That's why it's in "Off Topic".

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

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

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 7:01 am

ejolson wrote:
Mon Apr 15, 2019 5:25 am
Bare metal on the Pi seems most practical for hard real-time tasks. While interpreted BASIC may not be a good match for guaranteed maximumlatencies, learning and fun are often higher priority than practical. In particular, there is definitely value in creating a bare-metal programming environment on the Pi, perhaps based on Basic, which is simple enough that a single person could create it and many people understand how it works.
Its not bare-metal, but you can just add "init=/usr/bin/python" to /boot/cmdline.txt and it will boot directly into the Python ">>> " prompt.
If scriba had an interactive mode like the BASIC's of the past you may be able to do the same with that.

(That is, you run Python or Basic instead of systemd).

User avatar
bensimmo
Posts: 4172
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 10:32 am

hippy wrote:
Sun Apr 14, 2019 10:09 pm
jamesh wrote:
Sun Apr 14, 2019 8:58 pm
bensimmo wrote:
Sat Apr 13, 2019 9:32 am
Special?
The Pi in RaspberryPi is for Python.

Mainly as the choice of language that school children would be using.
It is/(was and even more so) the go to beginners text only language.
TBH not strictly true. I suppose Pi could in a small way relate to Python, but there are other reasons.
True. As Eben himself put it; "Pi is because originally we were going to produce a computer that could only really run Python. So the Pi in there is for Python".

https://www.raspberrypi.org/magpi/happy ... and-python
This is one of the references I was referring to, of course it then became a lot more (I only followed in the background at that time)
I didn't mean it was the only use for the Pi.


I must have missed something with the following post, as don't remember any posts needing deleting.

It been a good (long) thread with many different topics in it going off in tangent.
I doubt anyone else would join in now unless they've been skim reading over the 3 or 4 pages every now and again.

I wonder what Dave is thinking about his Avoiding Basic thread.

Basic is still taught in schools.

User avatar
Gavinmc42
Posts: 3718
Joined: Wed Aug 28, 2013 3:31 am

Re: Why Avoid BASIC on RPi?

Mon Apr 15, 2019 10:59 am

I wonder what Dave is thinking about his Avoiding Basic thread.
Probably adding basic to his baremetal port of AmigaOS?
Anyone else notice one of the VPU's in the VC4 could possibly emulate the Copper in the Amiga?
I suppose with 4 ARM cores on the 3B+, a core could emulate each Amiga chip?

Or he's writing a basic interpreter in Assembler?

It has taken me about 60 pages to reach the conclusion Basic could be useful :lol:
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

Return to “Off topic discussion”