Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
"WITH" keyword
#3
`WITH` in Freebasic was designed to save wear and tear for the programmer, having to type in the UDT variable's name.

Instead of:
Code: (Select All)
verylongvariablenamebutitsshorterjustforthisexample(j).x = i
verylongvariablenamebutitsshorterjustforthisexample(j).y = j

could break it down in that other programming system as:
Code: (Select All)
with verylongvariablenamebutitsshorterjustforthisexample(j)
.x = i
.y = j
end with

Some people would like to be able to exclude the period because it looks funny in front of an identifier like that. It's actually this way in Pascal but it could produce many long hours in debugging trying to find something.

I was being facetious in the example but when working with many UDT's, like must be done in Windows API programming, this `WITH` was helpful to a few programmers in the BASIC dialects that have it. If QB64 could feature macro substitution in its "preprocessor", however, I think `WITH` wouldn't really be necessary. In fact macro substitution could help make the code more readable.
Reply


Messages In This Thread
"WITH" keyword - by SpriggsySpriggs - 10-19-2023, 07:17 PM
RE: "WITH" keyword - by Dimster - 10-20-2023, 12:48 PM
RE: "WITH" keyword - by mnrvovrfc - 10-20-2023, 01:01 PM
RE: "WITH" keyword - by SMcNeill - 10-20-2023, 01:47 PM
RE: "WITH" keyword - by SpriggsySpriggs - 10-20-2023, 02:32 PM
RE: "WITH" keyword - by RhoSigma - 10-20-2023, 04:18 PM
RE: "WITH" keyword - by SpriggsySpriggs - 10-20-2023, 04:55 PM
RE: "WITH" keyword - by mnrvovrfc - 10-20-2023, 09:24 PM
RE: "WITH" keyword - by SMcNeill - 10-20-2023, 05:25 PM
RE: "WITH" keyword - by bplus - 10-20-2023, 05:30 PM
RE: "WITH" keyword - by bplus - 10-20-2023, 05:32 PM
RE: "WITH" keyword - by SMcNeill - 10-20-2023, 05:41 PM
RE: "WITH" keyword - by bplus - 10-20-2023, 07:40 PM
RE: "WITH" keyword - by bplus - 10-20-2023, 07:41 PM
RE: "WITH" keyword - by madscijr - 10-26-2023, 09:24 PM
RE: "WITH" keyword - by James D Jarvis - 10-27-2023, 04:01 PM
RE: "WITH" keyword - by madscijr - 10-27-2023, 10:50 PM



Users browsing this thread: 1 Guest(s)