![]() |
|
WITH/END WITH? - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: WITH/END WITH? (/showthread.php?tid=4131) |
WITH/END WITH? - bobalooie - 11-21-2025 Back in my VB6 days I would frequently make use of a WITH/END WITH block when I had UDTs with a lot of members. I believe it's still available in the Visual Studio flavor as well. How difficult would it be to implement this in QB64PE? RE: WITH/END WITH? - hsiangch_ong - 11-22-2025 you could write a preprocessor of "dot-bas" code, like i have done. how difficult it is to use search-and-replace? or creating temporary "helper" functions which are like "get" and "set" property methods? this "with" block like pascal is a real headache. could make code difficult to debug. especially with lazy naming of fields and variables. this is a short but silly example. temporarily use subprograms like "properties." in another programming language which supports oop. then when you think you are ready for a "release" version. remove those subprograms. do search-and-replace on the subprogram calls. however this could get messy, if you don't like using regular expressions... Code: (Select All) type mytypeRE: WITH/END WITH? - hsiangch_ong - 01-19-2026 (01-19-2026, 07:22 AM)ClarettaBrown Wrote: WITH / END WITH isn’t just syntactic sugar — it affects name resolution, scoping, and how the compiler/parser rewrites member access. said it better than i did. that the turbo pascal developers. were able to pull it off. before "oop" became an "awesome" thing. has to be praised very much. while the creators of unix and "c". have to be condemned for totally dismissing a "bondage" language. that had a couple of features that in a funny way. ended up in c++. RE: WITH/END WITH? - Pete - 01-19-2026 How about a MyType / Not MyType Sorry, couldn't resist, but good thoughts in this thread about keyword integration... Hmm, we really need an applause smiley. Pete RE: WITH/END WITH? - bplus - 01-19-2026 Well lets ask AI Quote:Using WITH/END WITH in QB64 Phoenix Edition (PE) would be a positive addition because it improves code readability and reduces the chance of typing errors, particularly when working with User-Defined Types (UDTs) that have many members. So nice work around idea, no? RE: WITH/END WITH? - Pete - 01-19-2026 Well just tell the motherboard ******* machine to implement it then! Pete - Everyone's a critic, but critics who can't code aren't worth 2-bits. RE: WITH/END WITH? - NakedApe - 01-19-2026 Dang, that AI knows this place well!
RE: WITH/END WITH? - bplus - 01-19-2026 OK here it is! ![]() Quote:Implementing VB-style WITH...END WITH in QB64pe involves using macros or custom preprocessor directives, as QB64 doesn't natively support it; you'd define macros like #Define With(obj) obj. and #Define EndWith to substitute for the shorthand, then use qb64pe -c (compile) or qb64pe -x (execute) from a script or build system to process these, creating a clear pull request on GitHub by showing the original code and the transformed output, explaining how these macros simulate the VB functionality. RE: WITH/END WITH? - Pete - 01-19-2026 It makes me want to erase all my code posts. I don't want to be the least bit responsible for bringing about the end of when the machines take over. Oh wait, I forgot, you need FreeBASIC for that! Pete RE: WITH/END WITH? - hsiangch_ong - 01-20-2026 the problem is. getting other people to want to run. an additional program. besides "qb64pe" executable. have the programmer. remember to always run "that other program on my beautiful code." if it should be preprocessed. i have done this before. but it was many years ago. i was getting an impressive mess. because i also desired to fake _continue. before it became a reality in qb64. i also desired to include into my preprocessor. something like a "loop list" processor. something like this: Code: (Select All) dim item as stringthe post by @ClarettaBrown above. was in english when i last replied. is my mind playing tricks on me?! |