PB vs C

For everything that's not in any way related to PureBasic. General chat etc...
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: PB vs C

Post by Quin »

TI-994A wrote: Wed Sep 25, 2024 2:40 pm As for the ternary operator, perhaps a page could be taken from Kotlin, which actually implements it with a very simple and readable BASIC-like syntax. That would be an excellent addition to PureBasic.
Ooh...you're right! That is nice!

Code: Select all

value = if (a == 1) true else false
I think that could blend nicely into PB's existing syntax.
plouf
Enthusiast
Enthusiast
Posts: 281
Joined: Fri Apr 25, 2003 6:35 pm
Location: Athens,Greece

Re: PB vs C

Post by plouf »

skywalk wrote: Wed Sep 25, 2024 3:50 pm
Quin wrote: Wed Sep 25, 2024 2:13 pm Every time one of these arguments comes up I ask this, and no one answers it... :mrgreen:
What exactly does "keep it basic" mean? PB is what I'd consider to be BASIC-enspired. "real" BASIC has subs/functions, dim var as string etc., and PB is one of the farthest languages from the rest of the BASICs I've used (VB, BCX, B4X, etc).
My guess at "keep it basic" is having a syntax that is more wordy and allows new programmers to quickly bring up graphical applications within hours to days of starting.
No trailing ; semicolons, pointers are pointers everywhere in the code.
(C defines a pointer once and then you must remember everywhere else it is referenced. :evil: )
This is my favorite syntactical sugar PB brings.
Also very glad PB uses base 0 for array indexing.

It is debatable the number of keywords of PB vs C, since many are api and lib driven.
Ex. UseSHA3Fingerprint, UseSQLiteDatabase, etc. are not in C.
The existence of so many starting libs under one uniform IDE and syntax, it is a disservice to label it basic.
agree to most points of skywalk
BASIC is established syntax rules, these syntax is more readable than "competitors" so even if involves shoud do it THEIR way not "some other way"
also the exosystem with build in commands which are simple to use also.
so f.e. Create a window and throu a gadget in it, need exactly 2 commands, not 2 pages of includes 3 pages of initializations and a few more ...
Quin wrote: Wed Sep 25, 2024 3:58 pm
TI-994A wrote: Wed Sep 25, 2024 2:40 pm As for the ternary operator, perhaps a page could be taken from Kotlin, which actually implements it with a very simple and readable BASIC-like syntax. That would be an excellent addition to PureBasic.
Ooh...you're right! That is nice!

Code: Select all

value = if (a == 1) true else false
I think that could blend nicely into PB's existing syntax.
the above example is a posible BASIC approach
IIF macro is also good and ALREADY active if wanted

however i have to agree to the thinking of "do we really need it ?"
i mean the main reason of ternary is to make a 4 line if /then/else to a single line,
but can already do it just in four lines (or cheat with : :))

consider that EVERY Adition done in PB , the team has to maintan it, that mean bugfixes/ adaption to all possible syntax now and in future (bug fixes actualyl too) and extra work in general

to me is not that important to use a single line for these speciall occasions, other stuff like raspberry support is by far more important / usefull
Christos
AZJIO
Addict
Addict
Posts: 2141
Joined: Sun May 14, 2017 1:48 am

Re: PB vs C

Post by AZJIO »

Quin wrote: Wed Sep 25, 2024 3:58 pm

Code: Select all

value = if (a == 1) true else false
This makes it more logical and there is no need to do complex code analysis.

Code: Select all

value = Ask(expression, true, false)
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PB vs C

Post by idle »

That's much easier on the eye AZJIO
Little John
Addict
Addict
Posts: 4770
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: PB vs C

Post by Little John »

idle wrote: Tue Sep 24, 2024 10:08 pm We're all entitled to opinions. :D
That is – or at least should be – a matter of course.
However, there are people who consider themselves extra clever, but don't even understand simple things like this.
tored
User
User
Posts: 86
Joined: Wed Feb 16, 2022 12:47 pm
Location: Sweden

Re: PB vs C

Post by tored »

What is funny is that I have it easier to grok low level stuff in PB over C and even more bizarre I also find it easier to import C functions in PB rather than writing everything in C. It is something in the mental model of PB that makes more sense to me.
PBJim
Enthusiast
Enthusiast
Posts: 293
Joined: Fri Jan 19, 2024 11:56 pm

Re: PB vs C

Post by PBJim »

I would prefer to see the developers' valuable time concentrated on important and worthwhile advancements, by which I mean features that add substantial value and maturity to the platform :

1. Networking SSL/TLS and making the networking operation more robust — it is currently quite easy to cause a network process crash on disconnections unless we employ some API workarounds

2. Printing to a specific named printer device — to my knowledge there is still only a dialogue box, which is not relevant in an unattended application
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PB vs C

Post by idle »

Little John wrote: Wed Sep 25, 2024 10:22 pm
idle wrote: Tue Sep 24, 2024 10:08 pm We're all entitled to opinions. :D
That is – or at least should be – a matter of course.
However, there are people who consider themselves extra clever, but don't even understand simple things like this.
The Dunning Krugers in the world probably, wouldn't agree!
User avatar
Lord
Addict
Addict
Posts: 898
Joined: Tue May 26, 2009 2:11 pm

Re: PB vs C

Post by Lord »

idle wrote: Thu Sep 26, 2024 7:43 am...
The Dunning Krugers in the world probably, wouldn't agree!
Dunning-Kruger is out. Read Gaze et al.
Image
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PB vs C

Post by idle »

Lord wrote: Thu Sep 26, 2024 9:37 am
idle wrote: Thu Sep 26, 2024 7:43 am...
The Dunning Krugers in the world probably, wouldn't agree!
Dunning-Kruger is out. Read Gaze et al.
how about a link and lets get back on topic!
User avatar
Lord
Addict
Addict
Posts: 898
Joined: Tue May 26, 2009 2:11 pm

Re: PB vs C

Post by Lord »

idle wrote: Thu Sep 26, 2024 10:07 am
Lord wrote: Thu Sep 26, 2024 9:37 am
idle wrote: Thu Sep 26, 2024 7:43 am...
The Dunning Krugers in the world probably, wouldn't agree!
Dunning-Kruger is out. Read Gaze et al.
how about a link and lets get back on topic!
I didn't introduce "Dunning-Kruger" in this topic. :wink:
https://theconversation.com/debunking-t ... age-195527
Image
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PB vs C

Post by idle »

I suffer the Dunning Kruger effect from time to time, though I'm aware of my incompetence plus I'm dyslexic which is why I prefer pb over c. I prefer to call it optimism otherwise I wouldn't try something sometimes if I didn't think it was achievable.

off topic. This still appears to be true today. The Peters Principle of incompetence.
https://en.wikipedia.org/wiki/Peter_principle
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: PB vs C

Post by TI-994A »

idle wrote: Fri Sep 27, 2024 8:53 pmI suffer the Dunning Kruger effect from time to time...
In some form, to some degree, we all do.

Although, some more than others. :lol:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Piero
Addict
Addict
Posts: 862
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: PB vs C

Post by Piero »

Incompetence never matters, if you are curious :x
User avatar
idle
Always Here
Always Here
Posts: 5834
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: PB vs C

Post by idle »

most of what I do is out of curiosity and PB is a lot easier to use than C in that respect and also easier to use assembler.
The only things missing from PB are minor. like unsigned longs and integers which can be a pain to deal with sometimes
or bitfields which are somewhat a rarity anyhow or multi dimension array [][] iterators and filling arrays with defaults

Code: Select all

Structure ar
  a.a[0]
EndStructure 

Global *ar.ar, i.i 
!unsigned char ar[] = {1,2,3,4,5,6,7,0}; 
!gp_ar = &ar;

While *ar\a[i] <> 0 
  Debug *ar\a[i]
  i+1
Wend   

Post Reply