Programmer's delight

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Programmer's delight

Post by djes »

Hello all,

We are a lot of oldschool coders there, having some experience with several programming languages, mixing paradigms as needed, learning for hours with websites, books, forums and so on. I remember the beginning of java, php, python and the pleasure I had with them. What I wanted to say is that the coding community enthusiasm is what leads to success. It's what happened each time.

So, the question is : what is giving a coder pleasure and fun ?

For me, easy : new horizons, breakthrough, not headache. I'm delighted when a language or a tool allows me to do something new, or something else better, faster, and I don't care if I have to learn to use it. The wow effect is what I'm looking for, too.

I have to say that with python, we have some of these breakthrough. And it is what I'd like to see in PB.

BASIC has always been the choice to discover coding, to learn, to do things and test ideas easily. Now, some things are easier with Python or PHP. I think that these languages are born because other languages were considered as limited. But BASIC shouldn't be seen as fixed in the past. What is BASIC : something easy to understand, to use, to manipulate. BASIC is what we decide it is.

An example : I'd like to see in PB easier large data manipulation. I'd like to play with arrays, lists, maps, vectors as with variables. I do not want the "power" of C, overloading, defining operators. I want it easy. I want to save, load it, send and receive it. The background is already there, but I don't want a new function : I want it integrated beautifully in the language, so that it seems natural.

And you, what would you want to see natively in a today's BASIC ?
Last edited by djes on Tue Jan 22, 2019 10:40 pm, edited 2 times in total.
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: Programmer's delight

Post by skywalk »

What is surcharging?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Programmer's delight

Post by djes »

skywalk wrote:What is surcharging?
Overloading, translation mistake...
User avatar
idle
Always Here
Always Here
Posts: 5042
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Programmer's delight

Post by idle »

A lot of this could be achieved if we had runtime reflection capabilities, then you could do all sorts of magic.

Fred has already added some reflection ability when he added copystructure back in 4.2 i think.
but it's just the minimal info to copy data structures with PB objects in them but there's no reason
why that couldn't be extended.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
HeX0R
Addict
Addict
Posts: 979
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Programmer's delight

Post by HeX0R »

You could do most of this (besides vectors I think) with the JSON lib, or am I misunderstanding something here?
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Programmer's delight

Post by djes »

Yes, in fact, JSON is showing what should be native. I'm talking about all these functionalities that could be added to give coders pleasure.

For example :
Dim MyArray = (("id", "name", "x", "y"), (1, "Point 1", 133, 10), (2, "Point 2", 27, 40)) ; The parser should recognize this kind of writing without anymore declaration. Be easy !
; Note the array without parentheses to distinguish from a normal array
; Note the automatic color to distinguish type instead of other decoration, could be applied to every type

SaveArray(MyArray, "C:\temp\Array.json", #JSON)

MyArray + (3, "Middle", (MyArray(1, "x") + MyArray(2, "x")) / 2, (MyArray(1, "y") + MyArray(2, "y") / 2))
It's just an illustration of what could be imagined to enhance PB, with the BASIC spirit... :)
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Programmer's delight

Post by Little John »

djes wrote:It's just an illustration of what could be imagined to enhance PB, with the BASIC spirit... :)
I agree, that would be nice to have.
As long as this is not built-in in PureBasic, we can do something like this.
Rinzwind
Enthusiast
Enthusiast
Posts: 636
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: Programmer's delight

Post by Rinzwind »

We don't even have inline array initialization (incl. direct passing as parameter to procedure)... Array initialization is VERY awkward in PB. In fact, I do not know any other language which does not allow one to declare and initialize an array with a one liner and the PB way makes some code ugly quickly.
Side note, I wish PB would introduce the [] as optional alternative for () since in PB the number of ('s start getting out of hand sometimes.
Post Reply