I'll add what John left as obvious: default values are pretty much
necessary for DataArrays, as they are used as the values hiding behind NAs.

Stefan, I'm wondering if you have any thoughts on how that could be
arranged better?  NAs are indicated by a separate Boolean array.  Leaving
those positions undefined in the main array was proposed, but it was quite
a headache.

Cheers, Kevib

On Thursday, February 27, 2014, John Myles White <johnmyleswh...@gmail.com>
wrote:

> FWIW, we used to have this in DataArrays/DataFrames and it was pretty
> unpleasant. The trouble is really that any code that calls the default()
> function is broken for any type that didn’t choose to implement it. So you
> end up constantly having to create the defaults yourself, while conceding
> that new types will be broken until you get around to fixing them.
>
>  — John
>
> On Feb 27, 2014, at 7:22 AM, Stefan Karpinski 
> <ste...@karpinski.org<javascript:_e(%7B%7D,'cvml','ste...@karpinski.org');>>
> wrote:
>
> Technically the empty string is the 1 of the string monoid. The point
> being that the correct default value depends on what you're doing. If we
> were going to have a default value function, it should be a different
> thing. I'm not convinced that we should encourage default values, however.
> They strike me as slightly sketchy.
>
>
> On Thu, Feb 27, 2014 at 9:54 AM, Iain Dunning 
> <iaindunn...@gmail.com<javascript:_e(%7B%7D,'cvml','iaindunn...@gmail.com');>
> > wrote:
>
>> Maybe implementing zero for strings could be a good idea... I've
>> implemented it for a few custom types, but theres always been a fairly
>> unambiguous meaning of what it means to be zero.
>>
>>
>> On Thursday, February 27, 2014 2:15:04 AM UTC-5, Avik Sengupta wrote:
>>>
>>> Well, there is zero(..) but that is defined only for numeric types
>>>
>>> julia> zero(Int64)
>>> 0
>>>
>>> julia> zero(ASCIIString)
>>> ERROR: no method convert(Type{ASCIIString}, Int64)
>>>  in zero at operators.jl:146
>>>
>>> julia> zero(Float64)
>>> 0.0
>>>
>>> On Thursday, 27 February 2014 06:25:39 UTC, Fil Mackay wrote:
>>>>
>>>> Is there an easy way, given a particular intrinsic Type, to create a
>>>> default (zero) instance? eg.
>>>>
>>>> z(Int64)
>>>> # 0::Int64
>>>>
>>>> z(ASCIIString)
>>>> # ""::ASCIIString
>>>>
>>>> Akin to the C# default 
>>>> keyword<http://msdn.microsoft.com/en-us/library/xwth0h0d.aspx>,
>>>> that returns the default initialised value of any type.
>>>>
>>>>
>
>

Reply via email to