Author Topic: Why do you care that much about BASIC part in the name of a language?  (Read 33265 times)

jj2007

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #105 on: August 29, 2016, 09:02:39 PM »
JJ: What happens if we GO TO 11 (jbe _11) in your last snippet? :)

Dunno, Dunny. Probably MASM barks at you  ;)

ScriptBasic

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #106 on: August 30, 2016, 12:58:48 AM »
Richey,

Here is the Script BASIC version of your example.

Code: [Select]
FOR i = 0 TO 10
  PRINT "2 TO THE POWER OF ",i," IS ",2^i,"\n"
NEXT


jrs@laptop:~/sb/sb22/test$ time scriba pow.sb
2 TO THE POWER OF 0 IS 1
2 TO THE POWER OF 1 IS 2
2 TO THE POWER OF 2 IS 4
2 TO THE POWER OF 3 IS 8
2 TO THE POWER OF 4 IS 16
2 TO THE POWER OF 5 IS 32
2 TO THE POWER OF 6 IS 64
2 TO THE POWER OF 7 IS 128
2 TO THE POWER OF 8 IS 256
2 TO THE POWER OF 9 IS 512
2 TO THE POWER OF 10 IS 1024

real   0m0.003s
user   0m0.000s
sys   0m0.002s
jrs@laptop:~/sb/sb22/test$


I also rewrote the C BASIC version as well.

Code: [Select]
#include <stdio.h>
#include <math.h>
#include "cbasic.h"

MAIN
BEGIN_FUNCTION
  DIM AS int i;
 
  DEF_FOR (i = 0 TO i <= 10 STEP INCR i)
  BEGIN_FOR
    PRINT ("2 TO THE POWER OF %d IS %0.f\n", i, pow(2,i));
  NEXT

  RETURN_FUNCTION (0);
END_FUNCTION 


jrs@laptop:~/c_basic$ gcc cpow.c -lm -o cpow
jrs@laptop:~/c_basic$ time ./cpow
2 TO THE POWER OF 0 IS 1
2 TO THE POWER OF 1 IS 2
2 TO THE POWER OF 2 IS 4
2 TO THE POWER OF 3 IS 8
2 TO THE POWER OF 4 IS 16
2 TO THE POWER OF 5 IS 32
2 TO THE POWER OF 6 IS 64
2 TO THE POWER OF 7 IS 128
2 TO THE POWER OF 8 IS 256
2 TO THE POWER OF 9 IS 512
2 TO THE POWER OF 10 IS 1024

real   0m0.002s
user   0m0.000s
sys   0m0.002s
jrs@laptop:~/c_basic$


Here is the expanded version without the C BASIC clothes.

Code: [Select]
#include <stdio.h>
#include <math.h>

int main (int argc, char** argv)
{
  int i;

  for (i = 0 ; i <= 10 ; ++ i)
  {
    printf ("2 TO THE POWER OF %d IS %0.f\n", i, pow(2,i));
  }

  return (0);
}
« Last Edit: August 30, 2016, 05:12:59 AM by John »

Tomaaz

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #107 on: August 30, 2016, 10:59:25 AM »
Still not very clear cut in all cases.

SpecBAS, for example, also allows for the use of procedures (DEF PROC) instead of GO TO / GOSUB as well as functions (DEF FN) and DO...WHILE and DO...LOOP[UNTIL] loops, CASE and has lots of in-built functions you would otherwise find in 'traditional' or 'modern' BASICs.

Well, we could argue about many things, but we have to agree that SpecBAS is a retro interpreter. ;) Firstly - mandatory line numbers. Secondly - the way it interacts with OS at the moment. Of course, it doesn't change the fact that SpecBAS is a very cool BASIC. "Retro" doesn't mean "bad" or "useles".

ScriptBasic is a completely different beast and I think that John has proved here that it's something more than a retro BASIC.

Of course, it's impossible to draw a line and say "everything on the left is retro, everything on the right isn't", but everyone who's tried different flavours of BASIC should, more or less, know what I'm talking about. And I'm pretty sure we can all agree that mandatory line numbers = retro. ;)

EDIT Things have got a bit nasty, here. Despite what Mike thinks and says, it wasn't my intention at all. ;) BP.org is gone, so please do not bring old conflicts here. ;)
« Last Edit: August 30, 2016, 11:02:17 AM by Tomaaz »

Mike Lobanovsky

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #108 on: August 30, 2016, 02:04:35 PM »
Here is the alternative in BASIC using SpecBAS...

Code: [Select]
10 FOR I=0 TO 10
20 LET A=2
30 PRINT A;" TO THE POWER OF ";I;" IS ";POWER(A,I)
40 NEXT I
50 STOP

Probably not the best one. LET A=2 had better be taken out of the loop. It's a constant, after all. :)

And in SpecBAS:

Code: [Select]
10 FOR EACH i IN [0 TO 10]: PRINT 2^i;" ";: NEXT i

.. and both in FBSL BASIC: :)

Code: [Select]
#APPTYPE CONSOLE
#OPTION IMPLICIT

20 LET A = 2
10 FOR I = 0 TO 10
30 PRINT A, " TO THE POWER OF ", I, " IS ", POW(A, I)
40 NEXT I

FOR EACH I IN {1, 5, 10}: PRINT 2 ^ I: NEXT

PAUSE

Ouput:

2 TO THE POWER OF 0 IS 1
2 TO THE POWER OF 1 IS 2
2 TO THE POWER OF 2 IS 4
2 TO THE POWER OF 3 IS 8
2 TO THE POWER OF 4 IS 16
2 TO THE POWER OF 5 IS 32
2 TO THE POWER OF 6 IS 64
2 TO THE POWER OF 7 IS 128
2 TO THE POWER OF 8 IS 256
2 TO THE POWER OF 9 IS 512
2 TO THE POWER OF 10 IS 1024
2
32
1024

Press any key to continue...



Here is the expanded version without the C BASIC clothes.

Code: [Select]
#include <stdio.h>
#include <math.h>

int main (int argc, char** argv)
{
  int i;

  for (i = 0 ; i <= 10 ; ++ i)
  {
    printf ("2 TO THE POWER OF %d IS %0.f\n", i, pow(2,i));
  }

  return (0);
}


... and the same in FBSL DynC:  :)

Code: [Select]
#AppType Console

C()

Pause

DynC C()
  double pow(double, double);
 
  void main() {
    int i;
   
    for (i = 0; i <= 10; ++i)
      printf("2 TO THE POWER OF %d IS %0.f\n", i, pow(2, i));
  }
End Dync

Output:

2 TO THE POWER OF 0 IS 1
2 TO THE POWER OF 1 IS 2
2 TO THE POWER OF 2 IS 4
2 TO THE POWER OF 3 IS 8
2 TO THE POWER OF 4 IS 16
2 TO THE POWER OF 5 IS 32
2 TO THE POWER OF 6 IS 64
2 TO THE POWER OF 7 IS 128
2 TO THE POWER OF 8 IS 256
2 TO THE POWER OF 9 IS 512
2 TO THE POWER OF 10 IS 1024

Press any key to continue...


Just to put things in the proper perspective, does anyone use masmbasic for anything useful other than you?

It is my firm belief that as long as at least one living person uses his pet language for whatever purpose he sees fit, be it JJ and his MasmBasic, or JRS and his Script BASIC, or me and my FBSL, the respective language is alive.
« Last Edit: August 30, 2016, 03:27:19 PM by Mike Lobanovsky »

ZXDunny

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #109 on: August 30, 2016, 02:23:42 PM »
Out of interest, mike, how does you {}s work in your example above? I can't find any documentation that mentions them on the FBSL forums beyond addressing string characters.

Mike Lobanovsky

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #110 on: August 30, 2016, 02:50:21 PM »
FBSL BASIC v3.4's documentation is a) ridiculously frenglish, and 2) dramatically incomplete.

{} is an old-timer in FBSL and IIRK it would work in v3.4 and earlier as well as in v3.5. {} in FBSL is not just a "figure of speech" but rather a distinct anonymous object that's roughly equivalent to a collection. It can contain anything from literals to class instances and is most often used for initializing dynamic variant arrays. It can't however be used for static arrays for stricter data type checking reasons.

Consider:

Code: [Select]
#AppType Console

Dim a[] = {%4321, %%4321, !4321, !!4321, "four three two one"}

For Each Dim e In {%1234, %%1234, !1234, !!1234, "one two three four"}
  Print e
Next

For Each e In a: Print e: Next

Pause

Ouput:

1234
1234
1234.000000
1234
one two three four
4321
4321
4321.000000
4321
four three two one

Press any key to continue...

ZXDunny

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #111 on: August 30, 2016, 02:57:13 PM »
Ahh, yes I see. Actually, that's a really neat way of auto-filling an array - I might steal that :)

Mike Lobanovsky

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #112 on: August 30, 2016, 03:06:08 PM »
You are most welcome. :)

ZXDunny

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #113 on: August 30, 2016, 03:40:50 PM »
I currently allow DIM var=(1,2,3,4) style, but using SpecBAS ranges might be better:

DIM a=[1 TO 10 STEP 2,40,50,60 TO 70,71 TO 72 STEP .1]

Of course, one of my seven users might have already used the old style with ()s...

Mike Lobanovsky

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #114 on: August 30, 2016, 03:57:45 PM »
Perhaps you could leave the older syntax as an option?.. They'll all switch to the new one eventually because it would look more distinct in the overall "spaghetti" style of SpecBAS scripts and would catch one's attention better, and then you'll be able to deprecate the use of parentheses for that particular purpose...

I'm often irritated with FBSL BASIC not supporting ranges. Don't really understand how I could overlook that feature. Might also add them though for consistency with other BASICs one of these days when I'm through with my WIP to update the Eclecta editor.

ScriptBasic

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #115 on: August 30, 2016, 05:12:11 PM »
Quote
ScriptBasic is a completely different beast and I think that John has proved here that it's something more than a retro BASIC.

Thanks Tomaaz!

Script BASIC is really a core traditional BASIC that is easy to use and extend. Runs on everything.

Cybermonkey

  • Administrator
  • *****
  • Posts: 0
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #116 on: August 30, 2016, 05:59:56 PM »
Retro... Commodore BASIC 3.5 was capable of that ...

Richly

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #117 on: August 30, 2016, 06:13:32 PM »
Here is the alternative in BASIC using SpecBAS...

Code: [Select]
10 FOR I=0 TO 10
20 LET A=2
30 PRINT A;" TO THE POWER OF ";I;" IS ";POWER(A,I)
40 NEXT I
50 STOP

Probably not the best one. LET A=2 had better be taken out of the loop. It's a constant, after all. :)

Gaahh...of course, thanks Mike. As our friends from across the pond say, my bad.

Thanks to you, B+, John, JJ and D for your versions - very much appreciated :)

John, where can I get hold of the latest Windows versions of C BASIC and Script BASIC and the accompanying documentation? (Yes, Aurel, I know...don't worry, I'm keeping my focus :)...)


Richly

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #118 on: August 30, 2016, 06:16:47 PM »
Still not very clear cut in all cases.

SpecBAS, for example, also allows for the use of procedures (DEF PROC) instead of GO TO / GOSUB as well as functions (DEF FN) and DO...WHILE and DO...LOOP[UNTIL] loops, CASE and has lots of in-built functions you would otherwise find in 'traditional' or 'modern' BASICs.

Well, we could argue about many things, but we have to agree that SpecBAS is a retro interpreter. ;) Firstly - mandatory line numbers. Secondly - the way it interacts with OS at the moment. Of course, it doesn't change the fact that SpecBAS is a very cool BASIC. "Retro" doesn't mean "bad" or "useles".

ScriptBasic is a completely different beast and I think that John has proved here that it's something more than a retro BASIC.

Of course, it's impossible to draw a line and say "everything on the left is retro, everything on the right isn't", but everyone who's tried different flavours of BASIC should, more or less, know what I'm talking about. And I'm pretty sure we can all agree that mandatory line numbers = retro. ;)

Yes, I don't think I'll split hairs over retro or Retro-style interpreter :)

ScriptBasic

  • Guest
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #119 on: August 30, 2016, 06:35:44 PM »
Quote
John, where can I get hold of the latest Windows versions of C BASIC and Script BASIC and the accompanying documentation?



C BASIC is nothing other than an include file of #define's that substitute or add place holders for a BASIC like translation. It isn't platform specific but you need to use gcc as the C compiler.

I would suggest joining the C BASIC Forum as we are adding BASIC string function support along with math.

Script BASIC - You have a couple choices with the Windows version. If you want a cool IDE w/Interactive debugger, VB COM/OLE/OCX support, than I would suggest Dave's Windows setup. If a traditional console mode interpreter is your cup of tea, there is a Windows 32 bit and 64 bit binary set on the Script BASIC forum you can download.

Look at the upper right corner of the Script BASIC forum for links to the BitBucket C BASIC examples and the wiki for Script BASIC.