Re: [julia-users] inner constructor returning an object of a different type

2016-06-11 Thread Rafael Fourquet
In the pre-jb/functions era, where higher-order functions where
suboptimal (because function calls would not specialize on them),
there was a trick using the feature you noticed to overcome this
limitation, i.e. make it fast. Cf the discussion at
https://groups.google.com/d/topic/julia-users/qscRyNqRrB4/Idiscussion.
Note that the fast-anonymous package by Tim Holy was using this trick.


[julia-users] inner constructor returning an object of a different type

2016-06-10 Thread Tamas Papp
Hi,

I have seen the following pattern in some library code: a type with an
inner constructor which returns a value which is not of that type. A
contrived example is

type Foo
Foo() = :something_else
end

Apparently this is OK (in 0.4.5 at least where I tried). Is this an
oversight? Or if this has an application, could someone please share an
example? (It made little sense in the context I saw it).

Best,

Tamas