Special Macro for types

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Special Macro for types

Post by Josh »

In many cases a special typedeclaration could make code better understandable. For example:

Code: Select all

TypeMacro bool
w
EndTypeMacro

Test.bool
Could also be useful for better checkable C-Structures

Code: Select all

TypeMacro CLongLong
q
EndTypeMacro

Test.CLongLong
According to the diskussions 1-2 PB releases back, it would make sense, that the TypeMacro could change typedeclarations to nothing

Code: Select all

TypeMacro AnyTerm
EndTypeMacro

*Test.AnyTerm
sorry for my bad english
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Special Macro for types

Post by Little John »

Josh wrote:In many cases a special typedeclaration could make code better understandable. For example:

Code: Select all

TypeMacro bool
w
EndTypeMacro

Test.bool
Could also be useful for better checkable C-Structures

Code: Select all

TypeMacro CLongLong
q
EndTypeMacro

Test.CLongLong
This can already be done with normal macros, no special "TypeMacro" needed.

Code: Select all

Macro bool
   i
EndMacro

Macro CLongLong
   q
EndMacro


a.bool
b.CLongLong
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Special Macro for types

Post by Josh »

Little John wrote: Could also be useful for better checkable C-Structures
Yes, thats clear. But when I fill my project with a lot of standard macros, i will get much trouble and this case of problems are hard to find. I always try to use unique identifier, but its not reasonable in each case.

With special macros i could use short and clear types without problems.

BTW: Changing to nothing is not possible with standard macros
sorry for my bad english
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Special Macro for types

Post by Little John »

Josh wrote:
Little John wrote: Could also be useful for better checkable C-Structures
No, I didn't write that.

I wrote:
This can already be done with normal macros, no special "TypeMacro" needed.
Josh wrote:Yes, thats clear. But when I fill my project with a lot of standard macros, i will get much trouble and this case of problems are hard to find. I always try to use unique identifier, but its not reasonable in each case.
Sorry, I don't understand what the problem is with just using normal macros that are already available in PB.
Giving unique names to identifiers is possible now, without such a "TypeMacro".
Josh wrote:BTW: Changing to nothing is not possible with standard macros
That's true. And the only purpose of that seems to be re-introducing obsolete syntax that has been abandoned. :-(
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Special Macro for types

Post by Josh »

Little John wrote:
Josh wrote:
Little John wrote: Could also be useful for better checkable C-Structures
No, I didn't write that.

I wrote:
This can already be done with normal macros, no special "TypeMacro" needed.
Ups, sorry. I shorted the quotation wrong.

Little John wrote:Sorry, I don't understand what the problem is with just using normal macros that are already available in PB. Giving unique names to identifiers is possible now, without such a "TypeMacro".
I see in your first post, that you don't understand. I want to give short and clear additional informations about the needed parameters shown in the statusbar quickhelp.


For me its better readable:

Code: Select all

Procedure Test (Param1.ui, Param2.bool, Param3.color)
instead of:

Code: Select all

Procedure Test (Param1.AUniqueType_ui, Param2.AUniqueType_bool, Param3.AUniqueType_color)
sorry for my bad english
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Special Macro for types

Post by Little John »

Josh wrote:
Little John wrote:Sorry, I don't understand what the problem is with just using normal macros that are already available in PB. Giving unique names to identifiers is possible now, without such a "TypeMacro".
I see in your first post, that you don't understand.

:?:
Josh wrote:I want to give short and clear additional informations about the needed parameters shown in the statusbar quickhelp.
Yes, this works fine here (with PB 5.31) with normal macros, like the examples that I wrote in my first post.
Post Reply