Only sort of the right place to put things

SpecialFolder.ApplicationData initially seems a great place to store your applications runtime data. But its only sort of the right place to put things

In reality its the right place for ALL applications to put their data. And becuase many applications can and do put their data there a good habit to get into is to create a DIRECTORY, or folder, specifically for YOUR application to put its things in rather than just toss all of the bits you might want to save in SpecialFolder.ApplicationData… Read the rest

Compiler issues I’ve reported

Over the past years iv’e reported a few compiler issues

Here’s the current list of open issues I’ve reported

55502 adding a constant to a class cant use an expression while one in code can
56376 compiler misidentifies syntax error on shared factory in super class
56378 factory pattern cant be implemented properly in Xojo esp when items are in a namespace
56765 compiler weird error message seems to be linked to wrong order of evaluation
57500 debugging a while loop in debugger appears to skip entire loop
58900 compiler incorrectly identifies unused local variables
59004 endexception constructor should probably be restricted in some fashion
59061 compiler gives a very ambiguous error message on select case statement
61901 compiler reports completely bogus error
61949 xojo does not warn of conversion on assignment
63438 compiler gets comparison confused with assignment
56264 make it so when a method returns an array you can immediately index into the return result
56272 optional parameters can only be “right most” parameters
60207 command line arguments for debug run cannot use a #constant

And there two I would love to see Xojo fix as its impossible for the usage to be ambiguous

56375 compiler incorrectly identifies “global” as syntax error
In something like an enumeration its impossible for the tokens for Global, Protected, Private and Public to be ambiguous.… Read the rest

A single set of libraries

This was asked on the Xojo forum

If the applications are developed by the same Xojo version, and all the exe files of several applications are placed in the same folder, is it possible for distribution purposes to have only one Libs folder ? In such case, which would be the name of this unique Lib folder ?

Read the rest

Save yourself some time

I see a lot of times people write code like

#if debugbuild
   system.debuglog "some message"

It means you type multiple lines of code all the time and if you forget to wrap things in the #if debugbuild then you have logging messages in your builds that maybe should have been turned off

Personally I have a module, named Debug, that has a method in it – Log

Then where ever I want a debugging message I can write

Read the rest

Extending end of line

In Xojo EndOfLine is two things
One is a global method and the other a Class.

Because of how the compiler works it realizes when you mean each one.

In a line of code like

var eol as EndOfLine

EndOfLine can, in that context, ONLY be a TYPE name. So the compiler knows you mean the EndOfLine class.… Read the rest

The trouble with tribbles….

Or in this case linear gradients. If you want linear gradients to work well you really need to calculate the correct start and end points.

This is especially true if you dont want a gradient that simply runs from left to right or top to bottom (or their reverse directions)

While figuring out exactly what I needed to do I had several different suggestions from different people that I found dont work quite right.… Read the rest

Practices you may see in use but you’ll regret using

Some code looks enticing – but in the long run may cause you as many headaches as it solves.

Some is really innocuous looking like :

var position as integer = otherString.IndexOf(EndOfLine)
var leftChars as string = otherString.left(position)
var rest as string = otherString.Middle(position + 1)

There’s an assumption in this little bit of code and it may not be entirely obvious what it is.… Read the rest