Home » U++ Library support » U++ Core » The problem with 'Null'
The problem with 'Null' [message #20446] |
Thu, 19 March 2009 08:04 |
gridem
Messages: 45 Registered: August 2008
|
Member |
|
|
I found that Upp uses the following practice: instead of creating already prepared object it creates the object with default constructor and than fill the necessary members in later calls. But using such approach the programmer should distinguish between init and non init state. One of the possible solution: apply 'Null' to the fields and than check by using IsNull.
The simple types (int, long etc) and Value already have such posibility. String also can use this but using another functionality:
return 'super' empty string that may be treated as 'Null'. The problem is that and IsNull(String::GetVoid()) return both true. This may be workarounded but it's not a good solution. But for the Vector<T> the workaround is more complex: the programmer should use One<Vector<T> >. The problem may occur in situation when function should return result or error. In the following example:
the solution exist: return String::GetVoid() on error. But what I can do when I must return Vector:
Vector<Templates> GetTemplateList()
Empty list denotes the there are no templates. But how can I return error without using terrible One<Vector<T> >?
|
|
|
|
|
The problem with 'Null'
By: gridem on Thu, 19 March 2009 08:04
|
|
|
Re: The problem with 'Null'
By: gridem on Thu, 19 March 2009 08:42
|
|
|
Re: The problem with 'Null'
|
|
|
Re: The problem with 'Null'
By: mirek on Thu, 19 March 2009 09:20
|
|
|
Re: The problem with 'Null'
By: gridem on Fri, 20 March 2009 08:16
|
|
|
Re: The problem with 'Null'
By: mirek on Fri, 20 March 2009 09:52
|
|
|
Re: The problem with 'Null'
By: gridem on Sun, 22 March 2009 09:15
|
|
|
Re: The problem with 'Null'
By: mirek on Mon, 23 March 2009 23:55
|
|
|
Re: The problem with 'Null'
By: gridem on Tue, 24 March 2009 08:41
|
|
|
Re: The problem with 'Null'
By: mirek on Tue, 24 March 2009 11:04
|
|
|
Re: The problem with 'Null'
By: mirek on Thu, 19 March 2009 09:16
|
Goto Forum:
Current Time: Fri Nov 01 00:16:42 CET 2024
Total time taken to generate the page: 0.01998 seconds
|