Page 1 of 2

InterfaceUnions

Posted: Sat Sep 24, 2005 11:48 pm
by MLK
can be usefull to create a few aliasnames pointing to the same procedure

Code: Select all

Interface INTERFACE 
   InterfaceUnion
      Remove()
      Kill()
      Destroy()
      Delete()
   EndInterfaceUnion
EndInterface
btw:
maybe its the best to replace 'StructureUnion/EndStructureUnion' to 'Union/EndUnion' and make it possible to use this in interfaces.

Posted: Sun Sep 25, 2005 12:38 pm
by remi_meier
Yesss! :)

Posted: Wed Sep 28, 2005 12:16 pm
by dell_jockey
I don't understand why you would want to have multiple aliases to the same function in a non-object oriented programming language.
Is it a good habit to enlarge language/library idiom without adding functionality?

Posted: Wed Sep 28, 2005 12:58 pm
by Fred
I have to admit than i don't see the use of having aliases pointing to the same function. If someone can clarify this, it should not be a problem to implement it.

Posted: Wed Sep 28, 2005 2:03 pm
by GedB
-1

Many PBers are struggling to make sense of Interfaces as it is, without adding further complexity.

Posted: Wed Sep 28, 2005 2:38 pm
by MLK
i have to admit, that im not still sure if using of unions would be better than using none, but have a (maybe?) better structured code for some bytes more. not to be sure means, im not sure, not im sure i dont like it anymore :-)

the idea was to write:

Code: Select all

Interface iGUI 
   ;ListIconGadget
   PrependRow(Text$)
   InsertRow(Row.l, Text$)
   AppendRow(Text$)
   
   ;PanelGadget
   PrependPanel(Text$)
   InsertPanel(Pos.l, Text$)
   AppendPanel(Text$)
   
   ;...
EndInterface
as:

Code: Select all

Interface iGUI
   InterfaceUnion
      PrependRow(Text$)
      PrependPanel(Text$)
   EndInterfaceUnion
   InterfaceUnion
      InsertRow(Row.l, Text$)
      InsertPanel(Pos.l, Text$)
   EndInterfaceUnion
   InterfaceUnion
      AppendRow(Text$)
      AppendPanel(Text$)
   EndInterfaceUnion
EndInterface
by using IsGadget(), IsWindow() ..... and GetGadgetType() [please implement in PB!] there is something nice possible..

Posted: Wed Sep 28, 2005 6:16 pm
by GedB
Why not this?

Code: Select all

Interface iGUI
   Prepend(Text$)
   Insert(Item, Text$)
   Append(Text$)
EndInterface    

Interface iRowGUI
   PrependRow(Text$)
   InsertRow(Row.l, Text$)
   AppendRow(Text$)
EndInterface    

Interface iPanelGUI
   PrependPanel(Text$)
   InsertPanel(Pos.l, Text$)
   AppendPanel(Text$)
EndInterface    


Posted: Wed Sep 28, 2005 8:02 pm
by MLK
because i like it easy

Posted: Wed Sep 28, 2005 8:32 pm
by netmaestro
Nah.

Posted: Wed Sep 28, 2005 8:58 pm
by GedB
How is this not easy?

Underneath you have a single vTable, and you just point the appropriate Interface at it?

It uses less lines of code, and it is clearer why different names exist.

Posted: Wed Sep 28, 2005 9:50 pm
by MLK
plz - stop discussion about everything not related to the suggestion of InterfaceUnions - thx

Posted: Wed Sep 28, 2005 11:55 pm
by FloHimself
MLK wrote:i have to admit, that im not still sure if using of unions would be better than using none, but have a (maybe?) better structured code for some bytes more. not to be sure means, im not sure, not im sure i dont like it anymore :-)

the idea was to write:

Code: Select all

Interface iGUI 
   ;ListIconGadget
   PrependRow(Text$)
   InsertRow(Row.l, Text$)
   AppendRow(Text$)
   
   ;PanelGadget
   PrependPanel(Text$)
   InsertPanel(Pos.l, Text$)
   AppendPanel(Text$)
   
   ;...
EndInterface
This is a typical case for the "extends" keyword.

Posted: Thu Sep 29, 2005 12:35 pm
by Fred
Sorry but i'm not convinced, it's sounds like a 'design flaw' to me. If you want to detect the gadget type with GadgetType() (assume it exists), the best is to define several interfaces for eachtype (which can eventually share the same VT, it's not a problem).

Posted: Thu Sep 29, 2005 1:46 pm
by MLK
WHY is everybody giving me tips to solve an unexistent problem?

i know what im coding and have no troubles with it. i know about the possibility to extend an interface with ONE other interface, indirect with more - thats how i started. i know how to design interfaces for each gadget individual - thats how i started. i know how to get the gadgettype. i know how to share a vTable.

THX for helping me in that difficult situation.


next time please keep it easy with -1/+1 or however u like to response to an feature request, a suggest, an idea to extend the language.

Posted: Thu Sep 29, 2005 2:13 pm
by dell_jockey
MLK wrote:WHY is everybody giving me tips to solve an unexistent problem?
Perhaps your real problem wasn't defined clearly enough, so that all reactions/tips were of no help to you?

Whatever the cause, there's no need to react this touchy.
This is one of the very few forums left, where information exchange most of the time takes place in a very polite and considerate manner. I lurk the German board as well, and I know that quite often the tone is a bit harsher over there. Please, let's not start with that on this forum... Thanks!