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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 12:40 am

John_Spikowski wrote:
Tue Nov 19, 2019 12:24 am
For me there is no difference between an inbuilt language feature and using a general purpose library or extension.
Exactly.

I wonder if the C submissions could get by without include files?
Yes, that would be easy. At most you would need to add a few extern declarations at the beginning of the program.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 1:42 am

You asked that it be removed. It is easy to put back. Would you like it to be put back?
Yes.

Thanks!

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 2:21 am

Yes, that would be easy. At most you would need to add a few extern declarations at the beginning of the program.
Like the two DECLARE statements in the ScriptBasic submission?

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 3:25 am

My point was that ScriptBasic was not up to the basic task of handling arrays natively!
ScriptBasic didn't support BigInt for fibo so we used GMP. The BASIC has a limit to it's native linked list / hash based arrays so I created the ta extension module to access a generic C byte array. (use the right tool for the job)

What SB arrays lack in speed, it makes up for in spades with functionality. I use it to create complex matrix structures C would have a hard time duplicating.

Every challenge in this thread ends up being lets try to pop the language bubble.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 5:59 am

John_Spikowski wrote:
Tue Nov 19, 2019 3:25 am
lets try to pop the language bubble.
I think it is good to remember that the main goal of this thread is to compare programming languages by actually writing code and helping others write code. This focus on reading and writing computer programs distinguishes what we do here from the philosophical discussions made by eductors and further prevents our efforts from turning into an emotional argument which causes indigestion at the dinner table. The latter is especially important when so much cabbage is on the menu.

As this thread is under the topic general programming chat and advice for beginners, who can best set the example of being appreciative and interested enough to understand the why and how of each working and nonworking challenge submission? Welcoming a diversity of programming techniques may lead to a greater understanding of what makes a good first programming language. It may also encourage the beginner to continue along the liberating path towards fluent computer literacy.

Earlier today I asked the dog developer whether a first language should support n-level meta programming. Fido looked up with a quizzical expression and then went back to popping the language bubbles that came in the mail-order box with the dog dictionary. Rather than philosophising any more, I guess it's time to get back to some challenging problems.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 6:34 am

John_Spikowski,
I wonder if the C submissions could get by without include files?
Yes of course they could. In fact if you remove them them from limited.c it complies and runs just fine.
Like the two DECLARE statements in the ScriptBasic submission?
No, not like that. Removing those includes from C does not remove the use of code that was specially written to solve the problem.
Every challenge in this thread ends up being lets try to pop the language bubble.
Not at all.

I think the logic here is simple and we seem to have been discussing it all year!

One is invited to present a solution to some programming problem for the purposes of comparing programming languages for ease of learning, ease of use, expressiveness and well let's face it performance.

Therefore it's a bit off that a solution said to be in language X actually has critical parts of the problem solved in language Y.

This all seems clear enough to me. One should not run a marathon by riding a bicycle!
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 7:18 am

It would be nice if people stop calling foul anytime I need to extend ScriptBasic to meet the challenge requirements. Should I just give up when you guys decide to take a challenge to absurd lengths to see what breaks along the way?

For example the Tatami challenge was defined at T(s)=200. Why is going to 2000 the next step when it leaves the RPi out in the cold?

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 7:53 am

John_Spikowski,
It would be nice if people stop calling foul anytime I need to extend ScriptBasic to meet the challenge requirements.
All would be fine if those SB libraries/extensions created to solve the problem were written in SB. If they are created in some other language one cannot claim they are SB language solutions anymore.

How can one compare language X to language Y when it turns out critical parts of the solution are written in language Z ?
For example the Tatami challenge was defined at T(s)=200. Why is going to 2000 the next step when it leaves the RPi out in the cold?
I agree. 200 is enough for me.

I can see the motivation for wanting to scale things up. Typically algorithms do not scale linearly in run time or memory consumption as the problem size gets bigger. Things one expects to be able to do suddenly turn out to be exponentially slow or huge. This is well worth being aware of and investigating. One often finds naive programmers using algorithms in their code that are totally unsuitable for the data they are dealing with, for example using a linked list instead of an array. So easy to do now a days when such algorithms are wrapped in simple library calls or language features. Then they wonder why their code is so slow!

It's a typical part of a CS under grads education. Those learning to program at home on the Pi can benefit from being aware of it as well.

With that in mind, and as we are on a Pi forum, I guess problem sizes should be limited to the half gig of RAM on a typical Pi and preferably not take all day to run!
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 8:04 am

All would be fine if those SB libraries/extensions created to solve the problem were written in SB. If they are created in some other language one cannot claim they are SB language solutions anymore.
ScriptBasic is written in C. How is expanding it in C a different language?

Peter designed SciptBasic as an embeddable API. Scriba was an example how to use it that took on a life of its own.

I could have static link the ta extension module with scriba to end this badgering and nonsense.
Last edited by John_Spikowski on Tue Nov 19, 2019 8:30 am, edited 3 times in total.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 8:23 am

John_Spikowski,
ScriptBasic is written in C. How is expanding it in C a different language?
Because C is a different language to SB. ScriptBasic is a programming language is it not? C is a different one.

ScriptBasic has a syntax and semantics defined somewhere I presume. Even if it's only actually defined properly as being "what the interpreter understands".

C is a programming language. It too has a syntax and semantics, defined by the C standard document.

These are two totally different languages. If I feed SB source into the C compiler it ain't going to work. If I feed C source into the SB interpreter it ain't going to work.

It does not matter that SB is written in C. That is an implementation detail. Any programming language can be implemented in any other programming language. SB could as well be implemented in Swift or assembler.

Large parts of the Rust, Swift and other language compilers are written in C++. They use the LLVM compiler back end. Despite the ease with which we can use C from Rust or Swift we make a distinction between the Rust, Swift and C languages.
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 8:47 am

I don't use static languages. Too restrictive.
If I feed SB source into the C compiler it ain't going to work.
I compile with gcc SciptBasic code all the time to generate small executables. My Tatamix.sb script would produce an executable less than 25KB.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:15 am

John_Spikowski,
I don't use static languages. Too restrictive.
?

Yes you do. As far as I can tell you have written extensions in C, a static language, for all the challenge solutions.

Usually I might add to get around the restrictions in time and or space of ScriptBasic itself!

Besides, how is that relevant to the current discussion?
I compile with gcc SciptBasic code all the time to generate standalone executables.
?

GCC is not C.

I use LLVM everyday when compiling Rust to generate standalone executables. That does not mean Rust is C++ or vice versa.
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:26 am

You don't use ScriptBasic nor do you know what you're talking about. I'm done explaining the obvious to you.

Smart people learn from everything and everyone. Average people from experiences. Stupid people have all the answers.
Last edited by John_Spikowski on Tue Nov 19, 2019 9:38 am, edited 1 time in total.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:37 am

John_Spikowski,
You don't use ScriptBasic or do you know what you're talking about.
Oh for goodness sake. Now you are going go all ad hominem.

What I use or know about is not pertinent to the question. Even if I used nothing and knew nothing it would not make the ScriptBasic language = the C language. No more than it would make the world flat or the man on the Apollo moon landing fake.

You now seem to be arguing that ScripBasic is in fact C.

OK, let's go with that. All so called "ScriptBasic" challenge solutions should be regarded as C solutions. And judged accordingly.

I think the difficulty here is I am talking about languages. Their definitions, syntax, semantics. You are talking about implementations as if that was the same thing. They are not. As I said by way of an example, GCC is not C.
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:46 am

As I said by way of an example, GCC is not C.
If you don't like gcc, any other C compiler will do.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:47 am

Code: Select all

$ cat hello.sb
print "HELLO WORLD"

$ gcc hello.sb
/usr/bin/ld:hello.sb: file format not recognized; treating as linker script
/usr/bin/ld:hello.sb:1: syntax error
collect2: error: ld returned 1 exit status
$ mv hello.sb hello.c
$ gcc hello.c
hello.c:1:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before string constant
 print "HELLO WORLD"
       ^~~~~~~~~~~~~
$
$ gcc hello.c
hello.c:1:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before string constant
 print "HELLO WORLD"
       ^~~~~~~~~~~~~
[email protected]:/mnt/c/Users/michael/tatami_rust$ clang hello.c
hello.c:1:1: error: unknown type name 'print'
print "HELLO WORLD"
^
hello.c:1:7: error: expected identifier or '('
print "HELLO WORLD"
      ^
2 errors generated.
Nope. Does not work :)
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:49 am

But "any other C compiler" is not C either.
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:54 am

Nope. Does not work
Works for me.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 9:56 am

Yes, but you have a compiler for a different language :)
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 10:05 am

I use gcc to compile everything having to do with ScriptBasic.

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 10:09 am

"Basil Fawlty : It doesn't matter. Look, it doesn't matter. Oh, I can spend the rest of my life having this conversation. Now, please, please, try to understand before one of us dies.

Manuel : I try."


:)
Memory in C++ is a leaky abstraction .

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 10:30 am

Do you dislike any language starting with a S?

ScriptBasic
Swift
Spikowski
...

User avatar
rpdom
Posts: 16097
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 11:10 am

John_Spikowski wrote:
Tue Nov 19, 2019 10:30 am
Do you dislike any language starting with a S?

ScriptBasic
Swift
Spikowski
...
Spanish? :lol:

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

Re: Liberation through Computer Literacy

Tue Nov 19, 2019 12:22 pm

Idiots, the lot of you. You just cannot help yourselves.

Have a closed thread and some demerits.

Edit: Have been pointed at this https://www.destroyallsoftware.com/talks/wat which just about sums up the last two pages of sad language wars.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

Return to “General programming discussion”