Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,18 @@
' FB 1.05.0 Win64
' FB does not currently support multiple inheritance. Composition has to be used instead if one wants
' to (effectively) inherit from more than one class. In some cases, this might arguably be a better
' solution anyway.
Type Camera Extends Object ' if virtual methods etc needed
' ...
End Type
Type Phone Extends Object
' ...
End Type
Type CameraPhone Extends Phone ' single inheritance
cam As Camera ' using composition here
' other stuff
End Type

View file

@ -0,0 +1,37 @@
define trait_camera => trait {
require zoomfactor
provide has_zoom() => {
return .zoomfactor > 0
}
}
define trait_mobilephone => trait {
require brand
provide is_smart() => {
return .brand == 'Apple'
}
}
define cameraphone => type {
trait {
import trait_camera, trait_mobilephone
}
data public zoomfactor::integer = 0,
public brand::string
}
local(mydevice = cameraphone)
#mydevice -> brand = 'Apple'
#mydevice -> zoomfactor = 0
#mydevice -> has_zoom
'<br />'
#mydevice -> is_smart

View file

@ -0,0 +1,11 @@
-- parent script "Camera"
property resolution
on new (me)
me.resolution = "1024x768"
return me
end
on snap (me)
put "SNAP!"
end

View file

@ -0,0 +1,13 @@
-- parent script "MobilePhone"
property ringtone
on new (me)
me.ringtone = "Bell"
return me
end
on ring (me, n)
repeat with i = 1 to n
put "RING!!!"
end repeat
end

View file

@ -0,0 +1,15 @@
-- parent script "CameraPhone"
property ancestor
on new (me)
c = script("Camera").new()
mp = script("MobilePhone").new()
-- make the Camera instance a parent of the MobilePhone instance
mp.setProp(#ancestor, c)
-- make the MobilePhone instance a parent of this CameraPhone instance
me.ancestor = mp
return me
end

View file

@ -0,0 +1,15 @@
cp = script("CameraPhone").new()
cp.snap()
-- "SNAP!"
cp.ring(3)
-- "RING!!!"
-- "RING!!!"
-- "RING!!!"
put cp.resolution
-- "1024x768"
put cp.ringtone
-- "Bell"

View file

@ -0,0 +1,6 @@
Property new: Camera
Property new: MobilePhone
Object Class new: CameraPhone
CameraPhone is: Camera
CameraPhone is: MobilePhone

View file

@ -0,0 +1,3 @@
class Camera {};
class MobilePhone {};
class CameraPhone << Camera, MobilePhone {};

View file

@ -0,0 +1,11 @@
protocol Camera {
}
protocol Phone {
}
class CameraPhone: Camera, Phone {
}