[Gambas-user] Object.Class(Me).Name and class name cases occassionally don't match
Benoît Minisini
gambas at ...1...
Wed Oct 31 15:18:42 CET 2012
Le 31/10/2012 15:13, Bruce a écrit :
> On Wed, 2012-10-31 at 14:02 +0100, Benoît Minisini wrote:
>> Le 31/10/2012 06:04, Bruce a écrit :
>>> I have a library which contains classes to analyse horse trial times.
>>> These classes rely on some files which contain some static data about
>>> the various analyses, these files are all called AbcZyx.meta where
>>> AbcXyz is the name of the relevant class (note the mixed case in both).
>>> When the first instance of any of these classes is created, it reads
>>> that associated file and sets up the static data.
>>>
>>> Somehow lately a strange thing has happened, one of the classes when it
>>> loads has it's name converted to lower case. All the others preserve
>>> the case of the class name.
>>>
>>> I've put the following trace into the early methods for some of the
>>> projects that use this library:
>>> Dim wkclass As Class
>>> For Each wkclass In Classes
>>> If Not IsNull(wkclass.Parent) Then
>>> If wkclass.Parent.Name = "BaseBO" Then Print wkclass.Name
>>> Endif
>>> Next
>>>
>>> and generally this is what I get vs the "real" class name:
>>> ClassNameloaded ClassNamereal
>>> --------------- --------------
>>> TrialSpeeds TrialSpeeds
>>> TrialSpeed1 TrialSpeed1
>>> TrialSpeed3 TrialSpeed3
>>> TrialSpeed2 TrialSpeed2
>>> TrackMap TrackMap
>>> TrackAltMap TrackAltMap
>>> Horse Horse
>>> trackname TrackName <------????
>>> Jockey Jockey
>>> Track Track
>>>
>>> So all of them, except TrackName have the expected class name.
>>>
>>> and when it tries to load the file via
>>> Dim sFilename as String
>>> Dim hMetaFile as File
>>> sFileName=Object.Class(Me).Name&".meta"
>>> Try hMetafile = Open $templatepath &/ sFileName For Input
>>> etc
>>> it fails, because of the case mismatching of the names.
>>>
>>> I have searched every file in the library project and all of the client
>>> projects and can not find any instance of the string "trackname". I
>>> have cleaned, recompiled etc etc each of these projects and this fail
>>> still occurs.
>>>
>>> Is there something special about a class called "TrackName"? It only
>>> ever happens for that class.
>>>
>>> Totally bewildered?
>>> Bruce
>>>
>>
>> There must be an occurence of "trackname" in lower case somewhere in
>> your source code. The name of the class is the first name encountered by
>> the interpreter.
>>
>> Regards,
>>
> That was my first thought too. But when I mean "searched every file" I
> mean as in 'grep -r trackname' in both the client projects and the
> library I get no result, not even in any of the binary files.
>
> What is even stranger, I tried to create a demo of this problem and the
> class names are all correct. Then I renamed the class in the library to
> "TrackNames" and everything works. Everywhere (well after a few
> corrections and recompiles that is.)
>
> Finally I renamed it back to TrackName and the problem reappears, but
> only in the original client projects, not in the "new" project. Which
> gets us back to "There must be an occurence of "trackname" in lower case
> somewhere in your source code."
>
> But according to grep (and the search form) there isn't. No code, no
> strings, no comments.
>
> I am going to go with using the new name (Tracknames) and rebuild
> everything that uses the library, but this is "weird".
>
>
> ...Uh oh, hang on..
>
> I just reread that "The name of the class is the first name encountered
> by the interpreter." bit.
>
> Maybe some other component/library used by these clients has a
> "trackname" symbol for something. hmmmm.
>
> be-back-tomorrow
> Bruce
>
Maybe the simpler would be naming your ".meta" file in lower case?
--
Benoît Minisini
More information about the User
mailing list