V4MD Noob: VOID instead of Vset with zero records?

Marc Schmitt Marc_Schmitt at gmx.de
Mon Apr 21 14:59:26 CDT 2008


Hi Ruslan,

thank you for anwering my question and sorry in advance for writing so much text ;)

Is there any chance, that this behaviour of V4MD will be configurable?

Personally, I prefer API-style code. It gives me the feeling to understand the logic behind and it looks just far more readable. This seems to be a personal decision, though.

Nevertheless, it is quite uncomfortable (or even unusable) to be forced to determinate everytime the type of the returned object. 

I don't know much about the other supported valentina-platforms, but in director there's a very bad (nearly none) error-handling: If I accidently want to access a property or method of a Vset and the object is VOID because there are zero records, this will bring an error and the program will stop. I know, that's not *your* problem, but it's mine :)

I understand that this behaviour is good for performance and should be consistent on all platforms, but it brakes Director/Lingo-logic that the type of the returned object will be violantly switched depending on the count of records. For director it's just inconsistent.

Just to over-state the case: 
The result of float(5.5) * float(0.0) should be float(0.0), not an undefined state, what VOID actually is. :) 

There's another (imho much bigger) problem with this logic in V4MD: 
Let's say you want to perform a search in the db. After that you want to use the resulting Vset as inSelection for another search. 

When the count of records is > 0 then there's no problem. 
But(!) when the result of the first search is VOID (because the count of records = 0) the inSelection of the second search will be interpreted as 'search all records in the table' instead of 'search in no record'. This will lead you into wrong results. 

So what can I do? For know, I can see only these two alternatives. 
First: Rewrite code to SQL-style
Second: After any manipulatiion of a Vset -> check object type of result -> if result is VOID -> create an Vset with zero records manually and use instead

For me, the first one isn't nice and the second one is not really an option because it would result in ugly code. I think in mind of backwards compatibility this behaviour should be just changeable/switchable. 

Best regards and cheers

Marc

BTW: Your german homepage seems to need some administration. When you click on the beta downloads of V4MD you will be misleaded to the general download page (not beat).


> > Now I stumble over the following problem:
> > When the result of a search should be a VbitSet with zero matching
> records, it returns VOID instead. 
> > this one is a feature or a bug? :)
> 
> Well, few comments :-)
> 
> 1) I think you are very rare Director developer which have choose API
> style
> of coding. Usually they prefer SQL and lists.
> 
> 
> 2) on C++ low level, the empty Set result we return as NULL over all
> engine.
>     Reason of this - is to save RAM as much as possible as well as
>     we avoid construction/destruction of empty set.
> 
> I think this logic was copied into V4MD. So I tend consider this as
> feature
> :-)
> 
> 
> -- 
> Best regards,
> 
> Ruslan Zasukhin


More information about the Valentina mailing list