Page 1 of 1

A couple of new Syntax things

Posted: Tue Dec 05, 2006 10:07 pm
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

Posted: Tue Dec 05, 2006 11:20 pm
by va!n
i am not really sure but i think for 1) you can use CompareMemoryString()...

Posted: Wed Dec 06, 2006 12:04 am
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:

Posted: Wed Dec 06, 2006 9:28 am
by Chrono Syndrome
I love 2) and 4) ideas ;) .

Posted: Wed Dec 06, 2006 2:56 pm
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.

Posted: Wed Dec 06, 2006 6:05 pm
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.

Posted: Wed Dec 06, 2006 10:32 pm
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)

Posted: Wed Dec 06, 2006 11:36 pm
by JCV
in perl we use 'eq'

Posted: Thu Dec 07, 2006 1:01 am
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:

Posted: Fri Dec 08, 2006 10:49 am
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.