[Implemented] With EndWith

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

[Implemented] With EndWith

Post by ts-soft »

Example:

Code: Select all

Structure Test
  First.l
  Last.l
  Text.s
EndStructure

MyTest.Test
With MyTest
  First = 1000
  Last = 9999
  Text = "Hello PureBasic"
EndWith
Is clear Syntax, i hope
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

i see one problem if your using varibles to set the structure that have the same name of the structure field you have problems
~Dreglor
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

EDIT: Oh my I'm thick sorry.
Last edited by Trond on Fri Sep 30, 2005 3:43 pm, edited 1 time in total.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

Or so:

Code: Select all

MyTest.Test
With MyTest
  \First = 1000
  \Last = 9999
  \Text = "Hello PureBasic"
EndWith
like other programming languages
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Yes, it's planned.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Post by ts-soft »

thx :D
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Excellent. 8)

Will it work with Interfaces, too?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

This will works as a real macro, which means you could put any expression after 'With', and it will be inserted before each orphan '\'.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

BB 2 from Amiga supported this feature.
It used an easy way to do, something like this:

Code: Select all

Structure Test 
  First.l 
  Last.l 
  Text.s 
EndStructure 
MyTest.Test
Structure Test1
  a.l
  b.l
EndStructure
NewList li.Test1()
USEPATH MyTest.Test
\First = 1000 
\Last = 9999 
\Text = "Hello PureBasic" 
AddElement li()
USEPATH li()
\a=24
\b=25
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Fred wrote:This will works as a real macro, which means you could put any expression after 'With', and it will be inserted before each orphan '\'.
Aha!, just replace the 'USEPATH' word by 'With' word :wink:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Hmmmm, Reaaaal Maaaaacrooooooooos!

imagine Homer like drool.
Post Reply