[Gambas-user] No return value (18)

Bruce bbruen at ...2308...
Mon Jun 25 14:36:15 CEST 2012


On Mon, 2012-06-25 at 20:49 +0930, Bruce wrote:
> Getting to be Friday 13th^2
> 
> On Mon, 2012-06-25 at 18:23 +0930, Bruce wrote:
> > Every day seems to be Friday the 13th at the moment!
> > 
> > Every so often, I manage to write a Property that has "No return value".
> > (It's always a case of something I have done, so it's not a gambas
> > problem.)
> > 
> > Today, I have done it again and I can't work out what it is that's
> > wrong.
> > 
> > In class Meeting
> 
> !! should have been "In class MeetingParser"
> 
> >         Property Read KnownMeeting as Boolean
> >         ...
> >         Private Function KnownMeeting_Read() As Boolean
> >         '==============================================
> >         ' Returns a quick check as to whether the meeting already exists
> >         ' on the database.
> >         
> >           Dim m As New Meeting
> > 
> >           If m.Exists([$trackcode, Format($racedate, "yymmdd")]) Then
> >             Return True
> >           Else
> >             Return False
> >           Endif
> >         
> >         Catch
> >             Error Subst("&1\nERR: ... blah blah blah, never happens.
> >         
> >         End
> > 
> > (The Meeting class is a database interface in a library.  The
> > Meeting.Exists([pkey]) As Boolean is a method that just checks for the
> > existence of the primary key in the pk index tables.*)
> > 
> > For the life of me I cannot see what I have done wrong here!
> > 
> > Any suggestions?
> > 
> 
> Bruce

OK! You can all stop looking, the car keys are in the pocket of my
"other jacket".  Apologies if that joke doesn't translate too well.

There may be a bug or at least an inconsistency.  Somewhere down the
inheritance chain there is a conditional statement that doesn't, under a
certain instance return any value.

The "other jacket" was the constructor call "Dim m as New Meeting".
Somewhere in a "maze of twisty little passages that all look the same"
is a _new() that contains something like:
        ...
        If dwarf.hasDagger then return true
        End

The possible bug/inconsistency is that the error (18) is not raised in
the Dim statement above, nor is it caught in the procedure that calls
the constructor. It is only in the client class of that one that the
error seems to be recognized.

It's strange that this error has not appeared before, as I said the
Meeting.Exists() method is executed over 40,000 times daily. ???

Nevertheless, Benoît, when I track it down you'll be the second to know.
(That is, ahem, someone who shall remain nameless made a stupid
mistake.)  

Stay tuned
Bruce





More information about the User mailing list