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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 2:13 am

ScriptBasic wrote:
Wed Apr 03, 2019 8:42 pm
Before bashing BASIC, check out ScriptBasic for the Raspberry PI.

https://ScriptBasic.org/forum

Free - Open Source - MIT License
If you are planning to compute the 4784969th Fibonacci number using ScriptBasic, a good starting point might be the visual Basic code from this post. Note that it would be nice to add this visual Basic version to GitHub as well.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 2:27 am

The ScriptBasic repo can be located from the forum in the Gitlab CE sandbox. The wiki contains the user and developer docs.

Please give ScriptBasic a try and I would love to hear your feedback.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 3:00 am

I would have to change my recursive limit setting in basic.conf for a number that large. Here is a Fibonacci script I wrote years ago.

Code: Select all

FUNCTION Fibonacci(n)
  IF n <= 2 THEN
    Fibonacci = 1
  ELSE
    Fibonacci = Fibonacci(n - 1) + Fibonacci(n - 2)
  END IF
END FUNCTION

PRINT Fibonacci(24),"\n"
jrs@jrs-laptop:~/sb/examples/test$ time scriba fibonacci.sb
46368

real 0m0.219s
user 0m0.218s
sys 0m0.000s
jrs@jrs-laptop:~/sb/examples/test$

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 3:38 am

@ScriptBasic,

The challenge calls for computing the first Fibonacci number with one million digits, fibo(4784969).

As mentioned by ejolson above you will likely want to use a faster algorithm than the recursive fibo, or even the schoolboy iterative fibo. Unless ScriptBasic handles large integers of course.

@ejolson,

Thanks for reminding me. I'll add that version when I have a moment.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 4:07 am

Though the challenge has moved pretty far from what most BASICs can do with their built-in types, and relies upon bignums. Old BASICs had one of two types of floats: traditional binary and decimal floats. The TI-99/4A, the MSX and a few others used decimal floats
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 4:11 am

ScriptBasic is 64 bit supporting max integers and floats. SB string size can be as large as available memory.
Raspberry Pi

A small and affordable computer that you can use to learn programming
If that is the mission, I can't think of a language easier to learn than ScriptBasic.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 7:45 am

scruss,

The challenge was always specified big Fibonacci numbers. Beyond what most languages accommodate without library support never mind BASIC.

However it was not really "about" big numbers. That was just the vehicle to include a slightly complex algorithm(s) that was not too big to code, nor too small. It's about how easy it is to write in the various languages, how easy it is to for others to understand. Performance being somewhat secondary.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 12:45 pm

ScriptBasic wrote:
Thu Apr 04, 2019 4:11 am
If that is the mission, I can't think of a language easier to learn than ScriptBasic.
How about:
  • having easy-to-find installation instructions that actually works (the Linux x86 ones assume running under sudo from the get-go, so nope nope nope), rather than dumping folks into a forum
  • make the source repo linked from your homepage, rather than dumping folks into a forum
  • have an easy-to-find language reference card
  • give a compelling reason to use it: is it compiled? is it fast? is it compatible with other languages? does it have nifty string handling? can it talk to network things easily? is it robust? does it have nice graphics libraries? is it cross-platform? does it have real-time sound and midi support? does it support simple GPIO? is there a nice editor? how easy is it to debug?
There are a million programming languages out there. Make a compelling case for us to use yours.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 3:24 pm

ScriptBasic wrote:
Thu Apr 04, 2019 4:11 am
If that is the mission, I can't think of a language easier to learn than ScriptBasic.
I was looking through the ScriptBasic documentation and found the Function and Command Reference which said
Reference wrote:JOKER(n)
Return the actual match for the n-th joker character from the last executed LIKE operator.
I wish all programming languages had a built-in joker function.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 4:26 pm

LIKE and SPLITA are two built in functions I use most.

Would it be okay to start another thread called Why use ScriptBasic on the RPi? :o

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 4:46 pm

Sure, why not?

Here or perhaps in the "Other Languages" section.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 5:40 pm

If you want to give ScriptBasic a quick try, download the AppImage version. Discussions here would be more helpful if you actually tried it.

Resouce Links

ScriptBasic.org
AllBasic.info

The ScriptBasic wiki for documentation and the sandbox repo for current source.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 6:50 pm

I think the biggest problem BASIC has is people assume it's another BBC retro language with no practicl use in today's world.

ScriptBasic is the glueware you have been looking for to get your projects done without getting buried in definition and frameworks.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 7:06 pm

I can appreciate that idea.

However you have a bit of a hard sell there. We have not been looking for "glue" languages. We have had dozens of them for decades: Awk, Perl, Python, PHP, Javascript, BASH, others I have no doubt forgotten.

I'm not into over arching "frameworks" much but libraries and modules are great. We have so many to choose from in the above languages.

Personally, I was done with BASIC in 1976 and in the light of the above I won't be looking at ScriptBasic seriously, just now I have my hands full with Verilog, SpinalHDL and Scala anyway. But if you contribute a fibo(4784969) to the challenge I will gladly give it a run and add it to the challenge repository.

plugwash
Forum Moderator
Forum Moderator
Posts: 3369
Joined: Wed Dec 28, 2011 11:45 pm

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 7:39 pm

ScriptBasic wrote:
Thu Apr 04, 2019 6:50 pm
I think the biggest problem BASIC has is people assume it's another BBC retro language with no practicl use in today's world.
No, the biggest problem basic has is it's not one language, it's a heap of incompatible languages. Some require line numbers, some have optional line numbers, some don't support them at all. There are at least three different styles for subroutines, (the old gosub style, the BBC basic style and the MS style). All have their own ways of interacting with the outside world once you move beyond the most basic of "input" and "print" statements.
ScriptBasic is the glueware you have been looking for to get your projects done
Sorry but when I look at both the official website and the wiki what I see looks like a half-finished toy project. For example I can't seem to find any documention for example of how subroutines and functions work. If such basic language features are not documented then I simply can't take your language seriously. Then there is the fact that a bunch of the documention is only available in chm format. Then there is the fact that when I follow the forum link from the home page or the wiki I get a blank white page.

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

Re: Why Avoid BASIC on RPi?

Thu Apr 04, 2019 7:41 pm

The RPi is about making curiosity affordable. The idea behind ScriptBasic on the RPi is to explore its feature set without having to venture beyond BASIC syntax. The C extension module API allows unlimited seamless expansion with a simple include. ScriptBasic is rock solid and used by a few BACnet vendors that burned it into firmware. I'm not interested in a language like Python that takes 10 MB just to get started. If running ScriptBasic from a shared object, the run-time executable is under 12KB. 8-)

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 2:10 am

I registered RaspberryBasic.org with the idea of using the domain for the Raspberry Pi ScriptBasic effort. If we have any talent out there that would like to help build the site, send me an e-mail to support@scriptbasic.org to discuss.

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 2:15 am

I installed the latest Visual Studio 19 yesterday.
Noticed it had some options C#, F#, VB for .NET.

.NET can run on microcontrollers, had a crazy thought.
Running VB on a .NET runtime on a Pi?
Skip the Win IoT bloat?

Probably spending too much time in baremetal land but it should work in theory?
When you add C#, F# into the mix, why has it not been done?
Or has it?

ScriptBasic looks interesting ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 2:28 am

ScriptBasic looks interesting
The feedback I've gotten over the years is new users wished they had tried it sooner.

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 2:46 am

@plugwash,

Thanks for your review. The forums are loaded with ScriptBasic examples. I can assure you that ScriptBasic isn't a toy.

Please give it a try.
(AppImage is only one file and installs nothing)

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 3:15 am

ScriptBasic wrote:
Thu Apr 04, 2019 5:40 pm
Discussions here would be more helpful if you actually tried it.
I have!

Code: Select all

$ ./sb
Segmentation fault
Good start, eh?

Took me a while to actually find the AppImage, which lurks here https://www.scriptbasic.org/forum/index ... attach=422 and need to be renamed on download.
Resouce Links
actual links would be helpful, not just text - we don't know where any of this is.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 3:18 am

ScriptBasic wrote:
Thu Apr 04, 2019 7:41 pm
… I'm not interested in a language like Python that takes 10 MB just to get started.
MicroPython is very small. Runs on the tiny ARM Cortex M0 on the micro::bit
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 3:20 am

I created a fresh Raspbery PI full NOOBS and tested the latest AppImage release. Everything seems to work great. I didn't install MySQL so that extension module wasn't in the test script set.

I've attached the ScriptBasic examples I used to test the following extension modules.

* cURL
* SQLite
* JSON
* XML
* Regex
* SBT - Threading

Examples not included:

MySQL
ODBC
Use this link to download the AppImage. The file in the zip should be sb. If it's anything else, you have an early development version.
Last edited by ScriptBasic on Wed Apr 10, 2019 6:52 am, edited 4 times in total.

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 3:26 am

@scruss,

Place the extracted sb file in your /usr/local/bin directory.

Version Info: sb -v

Dump the binary basic.conf sb -D

Run a script: sb myip.sb

If you get a module or include error message: sb -d <your_script>

Please try the example scripts I attached in the previous post. I assume you downloaded the AppImage from the ScriptBasic.org site? (latest build)

When I type sb on the command line this is what I get.

Code: Select all

pi@raspberrypi:~/sbrpi/examples $ sb
Usage: basic [options] program.bas

options: -o file_name
            specify output file, save binary format to file but don't execute
         -b file_name
            load binary format from file and execute
         -n
            do not use cache (no save, no load)
         -e
            execute after binary format was saved
         -v
            print version info and stop
         -c
            inform scriba that this is a CGI script.
         -C
            save C program output.
         -E
            save executable output. (may not work under some OS)
         -p preprocessor
            specify external preprocessor.
         -i preprocessor
            specify internal preprocessor.
         -f configurationfile
            specify configuration file
         -d
            debug module error (UNIX only)
         -k text_config_file
            compile the configuration file to binary
         -D
            dump the configuration file in text format
pi@raspberrypi:~/sbrpi/examples $ 
ScriptBasic User Guide (pdf)

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

Re: Why Avoid BASIC on RPi?

Fri Apr 05, 2019 4:21 am

ScriptBasic wrote:
Fri Apr 05, 2019 3:26 am
@scruss,

Place the extracted sb file in your /usr/local/bin directory.
Okay:

Code: Select all

$ sudo mv sb /usr/local/bin
$ ls -la /usr/local/bin/sb
-rwxr-xr-x 1 pi pi 3035392 Mar 30 21:25 /usr/local/bin/sb
Couldn't I just put it in ~/bin, though? It would be in my path all the same.
Version Info: sb -v

Code: Select all

$ sb -v
Segmentation fault
Dump the binary basic.conf sb -D

Code: Select all

$ sb -D
Segmentation fault
Need I go on?
I assume you downloaded the AppImage from the ScriptBasic.org site? (latest build)
Yup, the link I posted:

Code: Select all

$ md5sum /usr/local/bin/sb
b443934fb8959977e5dab3baa9f9cc69  /usr/local/bin/sb

$ cat /etc/os-release 
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

$ cat /proc/cpuinfo 
processor	: 0
model name	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 997.08
Features	: half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2835
Revision	: 9000c1
Serial		: 0000000083xxxxc1
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

Return to “Off topic discussion”