Skip to content

Instantly share code, notes, and snippets.

View canonic-epicure's full-sized avatar
💭
Well-typed API for the world

Nickolay Platonov canonic-epicure

💭
Well-typed API for the world
View GitHub Profile
require.paths.unshift('/home/nickolay/Playground/nodejs');
require('Task/Joose/NodeJS');
var sys = require('sys');
Joose.Module('SuperStuff', {
require : [ 'faye'],
use : [ 'Task/JooseX/Class/SimpleConstructor/Core', 'Task/JooseX/Role/Parameterized/Core', 'JooseX/Class/Singleton' ],
Class('Some.Another.Module', {
use : ['Some.Joose.Module']
})
var Script = process.binding('evals').Script
var sys = require('sys')
var puts = sys.puts
var runner = function (code) { return eval(code) }
var sandbox = {}
sandbox.me = sandbox
Role('Some.Trait', {
builder : {
methods : {
newBuilder : function (meta, info) {
meta.addProperty(...)
}
}
// sudden fail:
var a = instance.method()
(function() {
})()
eq
Role('JooseX.Attribute.Delegated', {
have : {
handles : null
},
override : {
getAccessorsFor : function (targetClass) {
Class("My.Class", {
use: ["Some.Module"], // trigger async loading
body : function (m) {
// m == this == My.Class here
// class will be ready here
}})
require('Task/Joose/NodeJS')
var puts = require('sys').puts
Class('Some.Class', {
has : {
attrib : {
is : 'rw',
require('Task/Joose/NodeJS')
var puts = require('sys').puts
Class('Some.Class', {
has : {
attrib : {
is : 'rw',
Class('Custom.Property', {
isa : Joose.Managed.Property,
does : Some.Role
// wrong, as Custom.Property will have the same meta-class as Joose.Managed.Property
// which is on 1st level and don't know what Role is
})
Class('Custom.Property', {