It's a common and useful pattern to have different constructors for the same
type. If that's all you need, then yes, julia has what you want.
I would guess that most people wouldn't call this "inheritance," though. Like
several other modern languages, Julia may be moving more in the direction of
I've recently experimented with a macro that solves a related problem (although
for different reasons). Basically it allows you to solve the same problems you
could solve using polymorphism, but by easing the burden of composition. It
might be helpful here too.
https://github.com/tlycken/IJuli
On Wed, 2016-03-23 at 16:48, kunal singh wrote:
> *the code works!!*
> I know that number== basic
> But the adding methods to number makes it ,from execution point of view ,
> an inherited class
But those methods can be called through basic as well as number and
basic are identical:
julia> m = b
And also @Mauro, Aren't the methods here ,that is, the constructors linked
to their respective types
On Wednesday, March 23, 2016 at 9:24:01 PM UTC+5:30, kunal singh wrote:
>
>
>
> On Wednesday, March 23, 2016 at 9:18:06 PM UTC+5:30, kunal singh wrote:
>>
>> *the code works!!*
>> I know that nu
On Wednesday, March 23, 2016 at 9:18:06 PM UTC+5:30, kunal singh wrote:
>
> *the code works!!*
> I know that number== basic
> But the adding methods to number makes it ,from execution point of view ,
> an inherited class
>
> On Wednesday, March 23, 2016 at 7:25:16 PM UTC+5:30, Stefan Karpinski
Is there any other method to inherit methods of a composite type ?
On Wednesday, March 23, 2016 at 9:18:06 PM UTC+5:30, kunal singh wrote:
>
> *the code works!!*
> I know that number== basic
> But the adding methods to number makes it ,from execution point of view ,
> an inherited class
>
> On W
*the code works!!*
I know that number== basic
But the adding methods to number makes it ,from execution point of view ,
an inherited class
On Wednesday, March 23, 2016 at 7:25:16 PM UTC+5:30, Stefan Karpinski wrote:
>
> Doing
>
> typealias B Union{A}
>
> makes B the same as A. Is this code meant
> I wrote a sample code which explains how inheritance can be done in Julia
> Let me explain what the code is about
> There is a Base Class : basic
> it contains two functions A and B
>
> Then there is number class which inherits from basic
> and number has its own Function C
> So number has in tot
Doing
typealias B Union{A}
makes B the same as A. Is this code meant to work today or is this
something you're proposing should work?
On Wednesday, March 23, 2016, kunal singh wrote:
> Hi,
>
> I wrote a sample code which explains how inheritance can be done in Julia
> Let me explain what the c
Hi,
I wrote a sample code which explains how inheritance can be done in Julia
Let me explain what the code is about
There is a Base Class : basic
it contains two functions A and B
Then there is number class which inherits from basic
and number has its own Function C
So number has in total three
Read through the julia-dev thread I linked to – this is addressed in depth
there.
On Tue, Mar 22, 2016 at 12:55 PM, Mauro wrote:
> > By the way isn't type Basic in my code a composite type?
>
> Basic is defined both as `type` and as `abstract` which will error.
>
> > So is there any way of inher
> By the way isn't type Basic in my code a composite type?
Basic is defined both as `type` and as `abstract` which will error.
> So is there any way of inheritance among composite types ?
No.
> Also is there any libraries which I can refer to which uses extensive
> inheritance?
>
> In C++ we ca
By the way isn't type Basic in my code a composite type?
So is there any way of inheritance among composite types ?
Also is there any libraries which I can refer to which uses extensive
inheritance?
In C++ we can easily inherit classes ? Why don't we have such ease in Julia
?
On Tuesday, March
Have a read on this oldish thread:
https://groups.google.com/forum/#!topic/julia-dev/eA4VkFAD-yQ. Still
applies today.
On Tue, Mar 22, 2016 at 11:30 AM, kunal singh wrote:
>
>
> On Tuesday, March 22, 2016 at 8:43:50 PM UTC+5:30, Mauro wrote:
>>
>> > Hi Mauro ,
>> >
>> > Can you show me any examp
Let me turn this around. Why do you feel like you need to inherit from a
concrete type?
On Tue, Mar 22, 2016 at 11:28 AM, kunal singh wrote:
>
>
> On Tuesday, March 22, 2016 at 8:43:50 PM UTC+5:30, Mauro wrote:
>>
>> > Hi Mauro ,
>> >
>> > Can you show me any example ?
>> > I am a beginner in Ju
On Tuesday, March 22, 2016 at 8:43:50 PM UTC+5:30, Mauro wrote:
>
> > Hi Mauro ,
> >
> > Can you show me any example ?
> > I am a beginner in Julia. It would of great help for me.
>
> In Julia the number types are defined here:
>
> https://github.com/JuliaLang/julia/blob/fdbcdf78bf0106e609a8
On Tuesday, March 22, 2016 at 8:43:50 PM UTC+5:30, Mauro wrote:
>
> > Hi Mauro ,
> >
> > Can you show me any example ?
> > I am a beginner in Julia. It would of great help for me.
>
> In Julia the number types are defined here:
>
> https://github.com/JuliaLang/julia/blob/fdbcdf78bf0106e609a8
> Hi Mauro ,
>
> Can you show me any example ?
> I am a beginner in Julia. It would of great help for me.
In Julia the number types are defined here:
https://github.com/JuliaLang/julia/blob/fdbcdf78bf0106e609a8d83b9e896d2d11bae594/base/boot.jl#L156
So there are the abstract types:
abstract Numbe
Hi Mauro ,
Can you show me any example ?
I am a beginner in Julia. It would of great help for me.
On Tuesday, March 22, 2016 at 8:01:47 PM UTC+5:30, Mauro wrote:
>
> You can only inherit from abstract types. Also, first defining
>
> type number
> ...
> end
>
> and then
>
> abstract number
You can only inherit from abstract types. Also, first defining
type number
...
end
and then
abstract number
is not possible. It cannot be both abstract and concrete. (Also note
that types are by convention Captialized).
So build your hierarchy only with abstract types and make concrete type
So basically there is a type called Basic defined as follows
type Basic
ptr::Ptr{Void}
function Basic()
z = new(C_NULL)
ccall((:basic_new_stack, :libsymengine), Void, (Ptr{Basic}, ), &z)
finalizer(z, basic_free)
return z
end
end
Now I want to create a h
21 matches
Mail list logo