A couple of new Syntax things

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

A couple of new Syntax things

Post by Konne »

1) I would like to have the Operator EQUALS. Because the = Operator is used to asign a value to a variable this one can't be used.

Here an example:

Code: Select all

procedure Test(Me.s)
if Me.s EQUALS "Test"
endprocedure
This Function would return 1 if Me is = "Test" and return 0 if its anything else

2) Callback parameter check
A possible Parameter checking for CallBacks would be great. It would make it easier to find bugs in codes etc.
I have an idea how to do such a thing, I would do it with Prototypes but maybe there's a better way.

For Example:

Code: Select all

Prototype.s CallBackPro(Value.q,Test.s)

procedure Test.CallBackPro (Me.q,Var.s)
  procedurereturn "Test"  ;We must return a String because the Prototype is defined like that.
endprocedure
3) Something for the IDE.
Macros without Parameters should be displayed bold.

4) Macro Return
This could be written one time in a Macro and it would define the way the macro is replaced.

For Example:

Code: Select all

Macro GetVal()
  lockmutex(ValMutex)

  MacroReturn Value
  
  unlockmutex(ValMutex)
 
  debug x
  debug GetVal()
  debug y
endmacro
This would be replaced with:

Code: Select all

  debug x
  lockmutex(ValMutex)

  debug MacroReturn Value ;  <- The Line with the MacroReturn
  
  unlockmutex(ValMutex)
  debug y
So for now that's all can think about. Hope Fred likes my ideas
Apart from that Mrs Lincoln, how was the show?
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

i am not really sure but i think for 1) you can use CompareMemoryString()...
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

About 1)

Code: Select all

Macro EQUALS
  =
EndMacro

Procedure Test(Me.s)
  If Me.s EQUALS "Test"
    Debug "TRUE"
  EndIf
EndProcedure 
:twisted: :twisted:
Chrono Syndrome
Enthusiast
Enthusiast
Posts: 169
Joined: Thu Oct 05, 2006 6:44 am
Contact:

Post by Chrono Syndrome »

I love 2) and 4) ideas ;) .
Don't try to catch ze Night !
Remember: 'z' is better zen 'th' =) !
Sorry for bad english.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

I hate 1), becasue in school we currently learn Delphi.

i hate to differ between an assign-operator and a compare-operator. I'm used to use = for assigning values AND cmparing things. Otherweise, you also must replace <> by NOEQUALS, and that would be %"/$&% !!



5) My idea for the IDE would be vertical lines connecting IF/ELSE, REPEAT/UNTIL, etc, etc... Just like jaPBe does.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

AND51 wrote:I hate 1), becasue in school we currently learn Delphi.

i hate to differ between an assign-operator and a compare-operator. I'm used to use = for assigning values AND cmparing things. Otherweise, you also must replace <> by NOEQUALS, and that would be %"/$&% !!
I can understand that u hate to use == and stuff like that. But on the other hand I hate slow and much writing stuff. Implementing this would be very easy and it also looks good (looks like AND XOR OR etc.)

PS. = Should still be useable as EQUALS in If too.
Apart from that Mrs Lincoln, how was the show?
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Then why don't you use a Macro to realize your idea as somebody showed us in his post?

If Fred says "Yes, I follow Konne's idea", then I would prefer to write "==" instead of EQUALS. (EQUAlS is too long)
PB 4.30

Code: Select all

onErrorGoto(?Fred)
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

in perl we use 'eq'
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Yes, and in perl we use "ne" for "<>".

In my opinion, the operators shouldn't even be touched. Those, who want "eq" or "EQUALS" as compairing-operator migght use a macro. A macro solves an additional problem: Konne wants "EQUALS", somebody else wants "eq" instead. Using macros, everybody can decide on his own, which word to use for an operator.

@ all: Please, the operator-questions is not the onliest problem. Let us talk aboout the other requests, please. You're also welcome to post your ideas, as I did. If you do that, you must go on with 6), cause my idea was 5). :wink:
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Konne
Enthusiast
Enthusiast
Posts: 434
Joined: Thu May 12, 2005 9:15 pm

Post by Konne »

IMHO there's no way to Build a macro as fast as EQUALS or EQ. (Maybe with ASM but i'm not good in stuff like that. And Own macros aren't bold ;) so u can't see them as easy). == wouldn't match with the PB Syntax IMHO. But something like EQ or EQUALS does. I mean there is XOR etc.
And nobodys talking about replacing <> etc.
Apart from that Mrs Lincoln, how was the show?
Post Reply