Home » U++ Library support » U++ Core » Value: why not float support?
Re: Value: why not float support? [message #30255 is a reply to message #30208] |
Mon, 20 December 2010 23:08   |
rylek
Messages: 79 Registered: November 2005
|
Member |
|
|
Hi there!
I'm afraid this is a difficult nut to crack. At first glance it seems that by adding the support of a new type (like float) to Value we are just enriching the U++ environment and not losing anything. Yet in reality I'm afraid we are losing some of Value's clarity. I, for instance, on numerous occasions make a switch over a Value's GetType(). Now, for instance, when we agreed some time ago to add BOOL_V and INT64_V, I had to manually adjust them to be able to accept a new value subtype. Some code broke in a very tricky way back then.
All right, my switches might not be the cleanest programming technique; at least I should finally ask Mirek to agree to add a series of inline functions to Core/Value.h to check Value types for these convertible groups of datatypes; like
inline bool IsNumberType(int value_type)
{ return value_type == BOOL_V || value_type == INT_V
|| value_type == INT64_V || value_type == DOUBLE_V; }
- equivalents of .IsNumber() etc. Value member functions, just operating on the type constants; but imagine what the above is going to look like when, after FLOAT_V, we continue to add LONG_DOUBLE_V and [U]INT8/16/32/64_V.
I myself, when working with ActiveX, for instance, sometimes find myself longing for better type distinction in Value in order to be able to provide a better mapping between Value and VARIANT. But then I ask myself: do I want U++ to become such pile of mess as the COM and Value such monster as VARIANT?
And yet, it's evident that on numerous previous occassions we didn't adhere to the position we now hold. We have already extended the numeric type set from the original INT_V / DOUBLE_V pair (not mentioning that even INT_V is in fact superfluous) to INT64_V and BOOL_V (see? we didn't upgrade INT_V to 64-bit, we added a different value type). We have STRING_V and WSTRING_V (here there is some justification because conversion of long binary blocks transferred through Strings, which was always seen as a sound option under U++, is time and memory consuming and potentially even lossy), DATE_V and TIME_V.
This whole discussion would be much easier if the value type was two-dimensional; the above type families (reflected in the member functions IsNumber(), IsString() and IsDateTime()) could then represent a 'principal' value type which would have a 'biggest' or 'most general' representant (double, WString and Time in the above case) and a (perhaps extensible) family of derived subtypes which would be able to convert themselves to and from the type family representant.
But it's not and, as I see it, it would cost all of us many a hair to seamlessly rework it like this. Even so, you still have situations like serializing Values where it's extremely unpleasant to have the type family growing all the time.
Regards
Tomas
|
|
|
 |
|
Value: why not float support?
By: kohait00 on Mon, 30 August 2010 10:54
|
 |
|
Re: Value: why not float support?
By: mirek on Tue, 31 August 2010 15:49
|
 |
|
Re: Value: why not float support?
By: kohait00 on Tue, 31 August 2010 16:11
|
 |
|
Re: Value: why not float support?
By: mirek on Tue, 31 August 2010 18:49
|
 |
|
Re: Value: why not float support?
By: kohait00 on Tue, 31 August 2010 22:02
|
 |
|
Re: Value: why not float support?
By: gprentice on Wed, 01 September 2010 13:52
|
 |
|
Re: Value: why not float support?
By: kohait00 on Wed, 01 September 2010 16:13
|
 |
|
Re: Value: why not float support?
By: mirek on Thu, 02 September 2010 09:40
|
 |
|
Re: Value: why not float support?
By: kohait00 on Thu, 02 September 2010 11:24
|
 |
|
Re: Value: why not float support?
By: mirek on Mon, 06 September 2010 10:40
|
 |
|
Re: Value: why not float support?
By: kohait00 on Mon, 06 September 2010 11:54
|
 |
|
Re: Value: why not float support?
By: kohait00 on Mon, 13 December 2010 15:47
|
 |
|
Re: Value: why not float support?
By: mirek on Wed, 15 December 2010 16:15
|
 |
|
Re: Value: why not float support?
By: kohait00 on Wed, 15 December 2010 16:41
|
 |
|
Re: Value: why not float support?
By: rylek on Mon, 20 December 2010 23:08
|
 |
|
Re: Value: why not float support?
By: kohait00 on Tue, 21 December 2010 08:20
|
 |
|
Re: Value: why not float support?
By: mirek on Fri, 24 December 2010 12:39
|
 |
|
Re: Value: why not float support?
By: kohait00 on Fri, 24 December 2010 13:55
|
 |
|
Re: Value: why not float support?
By: mirek on Sat, 25 December 2010 10:48
|
 |
|
Re: Value: why not float support?
By: kohait00 on Sun, 26 December 2010 11:28
|
 |
|
Re: Value: why not float support?
By: mirek on Mon, 27 December 2010 13:20
|
 |
|
Re: Value: why not float support?
By: kohait00 on Mon, 27 December 2010 14:28
|
 |
|
Re: Value: why not float support?
By: mirek on Mon, 27 December 2010 14:44
|
 |
|
Re: Value: why not float support?
By: kohait00 on Tue, 28 December 2010 13:47
|
 |
|
Re: Value: why not float support?
By: kohait00 on Mon, 07 March 2011 14:31
|
 |
|
Re: Value: why not float support?
By: mirek on Mon, 07 March 2011 23:04
|
 |
|
Re: Value: why not float support?
By: kohait00 on Tue, 08 March 2011 08:33
|
Goto Forum:
Current Time: Tue Jul 01 12:55:52 CEST 2025
Total time taken to generate the page: 0.03794 seconds
|