-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
👋 I really like your package. Thanks for having written it.
I am left with a question, though: how would you write a super call?
Here is a non-working example:
using Classes
@class Point begin
x
y
end
@class mutable ColoredPoint <: Point begin
color
end
function my_print(p::Point)
println("Point { x=$(p.x), y=$(p.y) }")
end
function my_print(p::ColoredPoint)
println("ColoredPoint { x=$(p.x), y=$(p.y), color=$(p.color) }")
end
call_my_print(p) = my_print(p)
my_value(p::Point) = 1
my_value(p::ColoredPoint) = 1 + my_value(convert(Point, p))This last definition is ill-defined; convert(Point, p) will ultimately fail. Have you thought about a way to define super call?
Metadata
Metadata
Assignees
Labels
No labels