11-22-2025, 12:41 AM
(This post was last modified: 11-22-2025, 12:50 AM by hsiangch_ong.
Edit Reason: add code example
)
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...
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.
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
