Shared With and automatic With in ForEach

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Shared With and automatic With in ForEach

Post by Trond »

Code: Select all

Procedure Apple()
  Shared With Banana() Fruits
  Fruits = 5    ; This is s_Banana.v_Fruits
EndProcedure

Procedure Orange()
  Shared With Banana() Fruits
  Fruits = 10   ; This is s_Banana.v_Fruits
EndProcedure

Procedure Banana()
  Static Fruits
  Fruits = 1    ; This is s_Banana.v_Fruits
EndProcedure

Procedure Basket()
  Shared With Bag() Fruits
  Fruits = 5  ; This is s_Bag.v_Fruits
EndProcedure

Procedure Bag()
  Static Fruits
  Fruits = 5  ; This is s_Bag.v_Fruits
EndProcedure

Code: Select all

; "Auto-with" in ForEach loops
ForEach StructuredList()
  \Member = 0
Next
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

And #PB_Compiler_ExeFormat.
thamarok
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 06, 2006 1:37 pm

Post by thamarok »

Agreed. I think these improvements will make it easier to deal with LinkedLists.

About #PB_Compiler_ExeFormat, I am not so sure about it, as you can select EXE in the Compiler Options. :?
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Code: Select all

CompilerIf #PB_Compiler_ExeFormat = #PB_ExeFormat_Console
  PrintN(Blah)
CompilerElse
  MessageRequester("", Blah)
CompilerEndif
thamarok
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 06, 2006 1:37 pm

Post by thamarok »

Trond wrote:

Code: Select all

CompilerIf #PB_Compiler_ExeFormat = #PB_ExeFormat_Console
  PrintN(Blah)
CompilerElse
  MessageRequester("", Blah)
CompilerEndif
Now this explains everything.
If this would be added, I could do one version which is DLL, Console and EXE and the user would only have to choose what he wants in the Compiler Options. THis would be good and I wouldn't need to distribute each version itself.

Trond, you really have good ideas :idea:
Post Reply