September Morn Update

This commit is contained in:
Ingy döt Net 2019-09-12 10:33:56 -07:00
parent 4e2d22a71d
commit aac6731f2c
6856 changed files with 141342 additions and 21127 deletions

View file

@ -1,24 +1,24 @@
class CameraFeature =
singleton CameraFeature
{
cameraMsg
= "camera".
}.
= "camera";
}
class MobilePhone
{
mobileMsg
= "phone".
= "phone";
}
class CameraPhone :: MobilePhone
class CameraPhone : MobilePhone
{
dispatch => CameraFeature.
dispatch() => CameraFeature;
}
program =
[
var cp := CameraPhone new.
public program()
{
var cp := new CameraPhone();
console writeLine(cp cameraMsg).
console writeLine(cp mobileMsg).
].
console.writeLine(cp.cameraMsg);
console.writeLine(cp.mobileMsg)
}

View file

@ -1,26 +1,26 @@
import system'dynamic.
import system'dynamic;
class CameraFeature
{
cameraMsg
= "camera".
= "camera";
}
class MobilePhone
{
mobileMsg
= "phone".
= "phone";
}
class CameraPhone =
singleton CameraPhone
{
new = MobilePhone new; mixInto(CameraFeature new).
}.
new() = new MobilePhone().mixInto(new CameraFeature());
}
program =
[
var cp := CameraPhone new.
public program()
{
var cp := CameraPhone.new();
console writeLine:(cp cameraMsg).
console writeLine:(cp mobileMsg).
].
console.writeLine(cp.cameraMsg);
console.writeLine(cp.mobileMsg)
}

View file

@ -0,0 +1,3 @@
TUPLE: camera ;
TUPLE: mobile-phone ;
UNION: camera-phone camera mobile-phone ;

View file

@ -0,0 +1,35 @@
abstract type Phone end
struct DeskPhone <: Phone
book::Dict{String,String}
end
abstract type Camera end
struct kodak
roll::Vector{Array{Int32,2}}
end
struct CellPhone <: Phone
book::Dict{String,String}
roll::Vector{AbstractVector}
end
function dialnumber(phone::CellPhone)
println("beep beep")
end
function dialnumber(phone::Phone)
println("tat tat tat tat")
end
function snap(camera, img)
println("click")
push!(roll, img)
end
dphone = DeskPhone(Dict(["information" => "411"]))
cphone = CellPhone(Dict(["emergency" => "911"]), [[]])
dialnumber(dphone)
dialnumber(cphone)

View file

@ -0,0 +1,3 @@
trait Camera {}
trait MobilePhone {}
trait CameraPhone: Camera + MobilePhone {}