User bio
404 bio not found
Member since Dec 9, 2015
Replies:

@Nicholai Mitchko's example above is Python calling an ObjectScript method that has pass-by-ref arguments, and that works as he described. I wondered if Python methods could be written to return values in their arguments, despite the fact that Python doesn't have pass-by-ref arguments. The answer is "yes," but only if the caller passes in a data structure (like a list or a dict) that the Python method modifies. Otherwise, arguments to a Python method called from either ObjectScript or Python can't return values.

If you make a loooonnnnng $piece-delimited string, and a lonnnnnnnnng $list, and you loop 1000000 times, accessing random pieces and random $list items, and sum up the time, and divide by 1000000, you'll find that for access, $lists are faster than delimited strings. At least that's what I saw when $list first appeared. But my mentor from that time said "Yes Joel, they are faster, but $list was added to ObjectScript so that we wouldn't have to worry anymore about delimiters, and sub-delimiters, and sub-sub-delimiters, etc."

True. I personally am not a fan of using #dim in any way other than:

#dim variable as objectclassname

because it makes it clear that #dim provides code completion for object variables, which is the functionality I care about. Yes, I know it also provides variable documentation for developers who are used to declaring datatypes in other languages

The other documented options:

  • #dim variable as objectclassname = initialvalue (ok, but I prefer #dim followed by set)
  • #dim variable = initialvalue (there's no reason to use #dim to do what set does)
  • #dim variable as non-objectclassname (this is documentation only; no code completion is provided)
  • #dim variable as list/array of objectclassname (again, documentation only; no code completion)
Open Exchange applications:
Followers:
Following:
Joel has not followed anybody yet.
Global Masters badges: