Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WITH/END WITH?
#2
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 mytype
    ident as string * 128
    offzet as _integer64
    verylongfield as _float
end type

dim shared container(1 to 100) as mytype

pvlfield 1, 4.5
pident 1, "this is only a test"
print container(1).verylongfield
print vlfield(1)
print ident$(1)
end

function vlfield## (which as integer)
    vlfield## = container(which).verylongfield
end function

function ident$ (which as integer)
    ident$ = container(which).ident
end function

sub pvlfield (which as integer, what as _float)
    container(which).verylongfield = what
end sub

sub pident (which as integer, what as string)
    container(which).ident = left$(what, 128)
end sub
some oop coders in c++/python actually do things this way.  precisely because they have to use longish field names.  at least to indicate the type of a class field.  so it's easy to inherit from that class.
Reply


Messages In This Thread
WITH/END WITH? - by bobalooie - 11-21-2025, 07:16 PM
RE: WITH/END WITH? - by hsiangch_ong - 11-22-2025, 12:41 AM
RE: WITH/END WITH? - by Pete - 01-19-2026, 04:32 PM
RE: WITH/END WITH? - by bplus - 01-19-2026, 05:25 PM
RE: WITH/END WITH? - by bobalooie - 01-27-2026, 02:44 AM
RE: WITH/END WITH? - by Pete - 01-19-2026, 05:34 PM
RE: WITH/END WITH? - by NakedApe - 01-19-2026, 06:21 PM
RE: WITH/END WITH? - by bplus - 01-19-2026, 06:39 PM
RE: WITH/END WITH? - by Pete - 01-19-2026, 06:40 PM
RE: WITH/END WITH? - by hsiangch_ong - 01-20-2026, 02:30 PM
RE: WITH/END WITH? - by bplus - 01-20-2026, 02:44 PM
RE: WITH/END WITH? - by Magdha - 01-20-2026, 04:10 PM
RE: WITH/END WITH? - by SMcNeill - 01-20-2026, 05:54 PM
RE: WITH/END WITH? - by bplus - 01-20-2026, 05:47 PM
RE: WITH/END WITH? - by hsiangch_ong - 01-21-2026, 02:39 AM
RE: WITH/END WITH? - by madscijr - 01-21-2026, 11:14 PM
RE: WITH/END WITH? - by bobalooie - 01-27-2026, 01:55 AM
RE: WITH/END WITH? - by madscijr - 01-27-2026, 04:38 AM
RE: WITH/END WITH? - by SMcNeill - 01-27-2026, 02:04 AM
RE: WITH/END WITH? - by bobalooie - 01-27-2026, 02:56 AM
RE: WITH/END WITH? - by Pete - 01-27-2026, 04:51 AM
RE: WITH/END WITH? - by madscijr - 01-27-2026, 05:02 AM
RE: WITH/END WITH? - by luke - 01-27-2026, 08:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question What happened to end year holiday season code? mnrvovrfc 5 1,071 12-27-2023, 02:39 PM
Last Post: GareBear
  So... I *think* I found the cheese at the end of the maze? MrCreemy 11 2,066 12-30-2022, 11:24 AM
Last Post: JRace

Forum Jump:


Users browsing this thread: 1 Guest(s)