Got an idea for enhancing PureBasic? New command(s) you'd like to see?
helpy
Enthusiast
Posts: 552 Joined: Sat Jun 28, 2003 12:01 am
Post
by helpy » Wed Feb 22, 2006 2:47 pm
It would be very helpful to have a wildcard for arguments. Here an example:
Code: Select all
Macro NEW(ObjectName,*)
ObjectName#_Constructor(*)
EndMacro
In this way, I could use the Macro for different Interfaces/Object_Constructors):
Code: Select all
obj1.Interface1 = NEW(OBJECT_1, initPar1)
obj2.Interface2 = NEW(OBJECT_2, initPar1, initPar2, initPar3)
obj3.Interface3 = NEW(OBJECT_3)
cu, helpy
Last edited by
helpy on Wed Mar 08, 2006 6:08 pm, edited 2 times in total.
helpy
Enthusiast
Posts: 552 Joined: Sat Jun 28, 2003 12:01 am
Post
by helpy » Wed Mar 08, 2006 6:05 pm
Hi all,
What do you think about this idea? :roll:
(... or did I have just a stupid idea
)
cu, helpy
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Wed Mar 08, 2006 6:16 pm
The idea is interesting, i take good notes
.
helpy
Enthusiast
Posts: 552 Joined: Sat Jun 28, 2003 12:01 am
Post
by helpy » Mon Jul 23, 2007 7:46 am
Hi Fred,
Do you have this idea still in mind?
cu, helpy
Windows 10 / Windows 7
PB Last Final / Last Beta Testing
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Mon Jul 23, 2007 7:28 pm
Well, yes, but it's not very high in the list
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Mon Jul 23, 2007 8:12 pm
sorry, I dont get the point...
if I say...
Code: Select all
Macro (one, two)
one#_bla (two)
EndMacro
where would be the difference?
isn't it handled already?
no joke.. really curious..
oh... and have a nice day.
codemaniac
Enthusiast
Posts: 289 Joined: Mon Apr 02, 2007 7:22 am
Location: Finland
Post
by codemaniac » Mon Jul 23, 2007 9:18 pm
Kaeru Gaman wrote: sorry, I dont get the point...
if I say...
Code: Select all
Macro (one, two)
one#_bla (two)
EndMacro
where would be the difference?
isn't it handled already?
no joke.. really curious..
Maybe it's more practical to have a wildcard than list the max arguments in the macro.
Cute?
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Mon Jul 23, 2007 9:30 pm
hm... but I did not see the * meaning more than one argument,in the codes posted above.
still ask: where is the point?
...I think there IS a point, if even Fred dealt with it.
....I just couldn't get it... mea culpa....
oh... and have a nice day.
Pupil
Enthusiast
Posts: 715 Joined: Fri Apr 25, 2003 3:56 pm
Post
by Pupil » Mon Jul 23, 2007 10:50 pm
Kaeru Gaman wrote: hm... but I did not see the * meaning more than one argument,in the codes posted above.
still ask: where is the point?
Please read the first post again, this time take some time to carefully look through the code parts of the post.
Kaeru Gaman
Addict
Posts: 4826 Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany
Post
by Kaeru Gaman » Tue Jul 24, 2007 9:26 am
ouch!
...must have worn blinkers yerterday...
deeply sorry
oh... and have a nice day.
Bonne_den_kule
Addict
Posts: 841 Joined: Mon Jun 07, 2004 7:10 pm
Post
by Bonne_den_kule » Tue Jul 24, 2007 4:01 pm
But if '*' char was wildcard, how should the compiler distinguish beetween that and the '*' char in front of pointers (like in *pointer.l)?
EDIT: Sorry, I though that '*' was the '#' (I havent studied the macro stuff good enough yet, and I was tired) sign for macros.
I did't read the argument thing.
Last edited by
Bonne_den_kule on Tue Jul 24, 2007 6:55 pm, edited 1 time in total.
thefool
Always Here
Posts: 5875 Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark
Post
by thefool » Tue Jul 24, 2007 4:30 pm
I like the idea.
Bonne_den_kule wrote: But if '*' char was wildcard, how should the compiler distinguish beetween that and the '*' char in front of pointers (like in *pointer.l)?
I think the * was just an example. However, have you seen a pointer with the name "*"? Remember, the argument passed was just * not *something.
AND on the other hand macro parsing is completely different from the others, and macro's do not use types for parameters.
helpy
Enthusiast
Posts: 552 Joined: Sat Jun 28, 2003 12:01 am
Post
by helpy » Tue Jul 24, 2007 4:49 pm
I just found a way to do the wildcard thing for the specific problem:
Code: Select all
Macro NEW(ObjectName, arguments=())
ObjectName#_Constructor#arguments
EndMacro
In this way, I could use the Macro for different Interfaces/Object_Constructors):
Code: Select all
obj1.Interface1 = NEW(OBJECT_1, (initPar1))
obj2.Interface2 = NEW(OBJECT_2, (initPar1, initPar2, initPar3))
obj3.Interface3 = NEW(OBJECT_3)
Although a wildcard would be nice for other things, where no such workaround would help.
Windows 10 / Windows 7
PB Last Final / Last Beta Testing