Page 1 of 1

Programmer's delight

Posted: Tue Jan 22, 2019 9:28 pm
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 ?

Re: Programmer's delight

Posted: Tue Jan 22, 2019 9:55 pm
by skywalk
What is surcharging?

Re: Programmer's delight

Posted: Tue Jan 22, 2019 10:39 pm
by djes
skywalk wrote:What is surcharging?
Overloading, translation mistake...

Re: Programmer's delight

Posted: Wed Jan 23, 2019 12:59 am
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.

Re: Programmer's delight

Posted: Thu Jan 24, 2019 6:40 pm
by HeX0R
You could do most of this (besides vectors I think) with the JSON lib, or am I misunderstanding something here?

Re: Programmer's delight

Posted: Thu Jan 24, 2019 8:05 pm
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... :)

Re: Programmer's delight

Posted: Thu Jan 24, 2019 8:45 pm
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.

Re: Programmer's delight

Posted: Fri Oct 08, 2021 9:29 am
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.