Page 1 of 1

crazy?

PostPosted: Wed Jan 29, 2014 9:53 am
by kobi7
please note line 152
the arrow marks the current line in the debugger.

the locals pane shows something a little crazy.

hassubs, nosubs are both false.
kind of amusing, and maybe rare so I'm sharing with you.

What do you make of it? :-)
(and what should my next step be? :roll: )

kobi

Re: crazy?

PostPosted: Wed Jan 29, 2014 11:29 am
by nerdzero
Could be a bug in the Mono debugger. What does "trace nosubs" show as the value?

Re: crazy?

PostPosted: Wed Jan 29, 2014 9:49 pm
by kobi7
it states:

trace: hassubs=false
- nosubs=false
- at GardenController.cobra:153
- in GardenController<of>.vc_check
- subclass GardenController`1


When I compiled monodevelop, I compiled mono from a git source, though I assume that such a fundamental logic error would show itself previously.
I guess I have to accept that reality is not logical ;-) hehe this episode is kind of strange to me.

Re: crazy?

PostPosted: Thu Jan 30, 2014 9:08 am
by nerdzero
:o

Re: crazy?

PostPosted: Thu Jan 30, 2014 9:24 am
by kobi7
how shall we ever get to the bottom of it? :-)
care to test the code? I can send you the source if you promise not to peek. hehe just kidding

joined debug session?
leave your email address, or send an email to me: kobi2187@gmail.com
I can zip it all, and put somewhere.

a short update

PostPosted: Sat Feb 01, 2014 12:41 am
by kobi7
nerdzero dexterously found the problem, and a bug report was filed #359

it had to do with nilable values that were not nil, regarded as true, no matter what the value inside actually is (which in this case was 'false')
came about when using dynamic? (or Object? I'm not sure) from an external library. (I just forgot to state the result type of a boolean getter)

any truth value that if accepts is probably susceptible here.

Re: crazy?

PostPosted: Sat Feb 01, 2014 5:08 am
by hopscc
It comes down to assuming the action on a short cut notation conditional test ( for a nilable Object or nilable Dynamic type from a library)
and/or not explicitly typing your getters .
( not helped by the doc/wiki being silent on that exact case).
If either the test was explicitly expanded, the item correctly cast or the getter was explicitly typed you would have been fine

any truth value that if accepts is probably susceptible here.

If its declared (explicitly or implicitly ) as nilable (Object/Dynamic) and not cast to the underlying type for an implicit truth test.


You can often see some light from problems such as these by looking at the generated C# code ( -kif option to compiler keeps the intermediate files around after compilation x.cobra -> x.cobra.cs) .

Alternatively and perhaps easier the ct_trace statement tells the compiler to emit some info about a variable as it goes through the various compiler stages, working out what it is, what interim type, final type, etc..
ct_trace hassubs

The output may be a little unintelligible to understand at first pass. (ctTrace)