Giter Site home page Giter Site logo

tinkerbell's Introduction

tinkerbell's People

Contributors

back2dos avatar simn avatar misprintt avatar

Stargazers

paling avatar Miraculous Ladybugreport avatar Ben Morris avatar Matthijs Kamstra avatar Datee avatar Kevin Gliewe avatar Pablo Martin avatar Basma Elshoky+ avatar Angus H. avatar Björn Roberg avatar Todd Kulick avatar James Thompson avatar François Barbut avatar David Merckx avatar pah arif avatar Sergey Melnikov avatar  avatar Leo Lännenmäki avatar Jens Fischer avatar sharow avatar julsam avatar Stefan Wasilewski avatar Jon Borgonia avatar  avatar Emmanuel Oga avatar Oleg Butovich avatar Andy Lu avatar Caribou (lraymond) avatar Andreas Rønning avatar dashuo.eth avatar Justin Donaldson avatar Rui Zhang avatar Bohdan Makohin avatar Franco Ponticelli avatar Jonathan Rose Dunlap avatar Brad Pillow avatar Heinz Hölzer avatar  avatar Simon Richardson avatar Jonas Malaco avatar Dan Ogles avatar  avatar Thomas Fétiveau avatar mparaiso avatar Nisse Bergman avatar Zaphod avatar Nick Arnoeyts avatar James Jackson avatar  avatar  avatar ebugsky avatar  avatar Chris avatar Jonathan avatar  avatar Mike Thornton avatar Peng Li avatar Ruben avatar Danny Wilson avatar Jason O'Neil avatar Adam Harte avatar Dima Granetchi avatar  avatar Andrew McHarg avatar Philipp Klose avatar Brad Parks avatar Cauê Waneck avatar francesco agati avatar Daichi Shinozaki avatar Dominic Graefen avatar Adam Wentz avatar Marcus Bergstrom avatar Ezequiel Moreno avatar David Peek avatar  avatar Simon Richardson avatar Andy Li avatar  avatar Marcelo Serpa avatar Sergey Miryanov avatar Mike avatar Joohun, Maeng avatar Clément Charmet avatar

Watchers

 avatar  avatar Zaphod avatar  avatar Heinz Hölzer avatar  avatar David Merckx avatar Joe Williamson avatar  avatar

tinkerbell's Issues

can @:forward could auto add other argument to method?

can @:forward could auto add other argument to method?

typedef ITest= {

 function say (a:Int, b:String):String;

}

and after @:forward

function say (a:Int, b:String,recall:Void->Void,args:Array):String;

Is that possible?

Delegation parameterized member property compilation error

http://pastebin.com/XPqwU8ma

This error occurs on the fact that Foo.owner has a type T. I presume that this is a valid use of delegation. Please, please, please specify:

  1. An ETA to a fix OR
  2. Is this problem isolated to lang.macros.Forward? If there isn't an expected fix by today, I'll probably be working to fix it this evening so please provide any input you may have to get this working asap. Why is the delegation class's parameter being transplanted into the forwarding class? The parameter of the delegation class is irrelevant apart from a check that the specified parameter conforms to any constraints. The parameterized member property needs to have a type that is specified by the instance. What is tink doing at this time?
    I either need this functionality or not use tink and I really want to move forward from this problem.

Question:how to use tink_lang with Dynamic resolve ?

first ,thanks your greate lib. and my problem is .
code like

//////// from
var url:String = "http://localhost:8080/index.n";
var c:AMFConnection = AMFConnection.urlConnect(url);
c.setErrorHandler(onError);
//var IC
c.HelloService.hello.call(["one", "two"], onResult);

////
to:

typedef Obj ={

i:Int,
s:String,

}
typedef Hellox = {
function hello(x:String, y:String):String;
function getLength(data:Array < String>):Int;
function getObject(obj:Obj) :String;
function getClass(p:Bytes):Dynamic;
}
typedef FwdTarget = {

function onError(e:Dynamic):Void;

function onResult(r:Dynamic):Void;

}
class Forwarder implements Cls {
var fields:Hash = new Hash();
@:forward(!multiply) var target:FwdTarget;

@:forward function fwd2(z:Hellox) {
    get: fields.get($name),
    set: fields.set($name, param),
    //call: trace('calling '+$name+' on '+$id+' with '+$args)
    call: trace('calling '+$name+' on '+$id+' with '+$args),//how to rewrite this line  the same as 

}
var c:AMFConnection;

function callRemoting(name, id, args):Void {
    //c.HelloService.hello.call(["one", "two"], target.onResult);
}
public function new(target) {
    this.target = target;
     var url:String = "http://localhost:8080/index.n";
     c = AMFConnection.urlConnect(url);
     c.setErrorHandler(target.onError);
}

}

I don't know how to write call: in @forwart ?
call: trace('calling '+$name+' on '+$id+' with '+$args),//how to rewrite this line the same as
c.HelloService.hello.call(["one", "two"], onResult);
any idea?

@:forward not work in wiki example

class Stack implements tink.lang.Cls {
@:forward(push, pop, iterator, length) var elements:Array;
public function new() {
this.elements = [];

   }

}

//
src/Stack.hx:9: characters 9-16 : Invalid number of type parameters for Array
C:\Motion-Twin\haxe\lib\tink_lang/0,4,0/tink/lang/Cls.hx:10: characters 3-12 : Build failure
src/Stack.hx:9: characters 46-65 : Invalid number of type parameters for Array
src/Stack.hx:11: characters 12-25 : Stack has no field elements

Feature request: Automatic generation of interface for delegation member/class

Automatic generation of the interface of the delegation object would eliminate the manual creation of the interface delineating the composed functionality:

class Human implements MouthI {
@:forward mouth:Mouth;
}
class Mouth implements MouthI {
}

This is extremely relevant imo as it is often the case that one needs to specify a function parameter as mouth or whatever other interface.

In terms of implementing this:

In a @:forward(i) (would by my preferred declaration, but @:forward("interface") may be more sane) declaration, have an option to specify that you want the forwarding interface appended. Add the delegation class to be interfaced to a nonduplicate set datastructure and add all classes requiring the interface. Generate interfaces and append as specified.

I will most likely implement this this week, but if you could do it that would be amazing as you know the framework and the relevant code I don't imagine would be particularly extensive.

support non-instance-field-saved arguments to new()

(like what i said in #20)

i wish i could specify something that was a required argument to new() but not something that became a full-blown instance field. i just want it to be available during the constructor function.

fix for pretty tink.macro.tools.TypeTools.toComplex with Type paramater <T>

Hi,

When using TypeTools.toComplex with pretty == true, references to abstract types are incorrectly qualified to the source type's module (they should remain unqualified, otherwise they cause compilation errors)

This can be fixed by checking if the ClassType.kind == KTypeParamater, and not including the module in the TPath path.

E.g.

/**
Override baseToComplex to prevent qualified paths on generic <T> types 
*/
static function classToComplex(t:ClassType, params:Array<Type>)
{
    switch(t.kind)
    {
        case KTypeParameter:
            return asComplexType(t.name, paramsToComplex(params));
        default:
            return baseToComplex(t, params);
        }
}
static public function toComplex(type:Type, ?pretty = false):ComplexType {
    return 
        if (pretty) {
            switch (type) {
                ...
                case TInst(t, params):  
                    classToComplex(t.get(), params);
                ...
            }

explain how / add support for structural type matches

if i have a class that uses tink.lang.Cls and then has e.g. @:read var foo:String, and then i want it to match a typedef structural type, what is the right definition of the structural type?

typedef TFoo = { function get_foo():String; } seems to give me "the field get_foo() is not public".

toComplex infinite recursion with recursive constraints?

It would appear that toComplex falls into infinite recursion with the following patterns:

s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:224: characters 63-91 : Called from
s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:203: characters 19-37 : Called from
s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:207: characters 48-71 : Called from
s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:228: characters 16-40 : Called from
s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:203: characters 19-37 : Called from
s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:224: characters 63-91 : Called from
s:/_flash/shared_haxe/tinkerbell_h3/src/tink/macro/tools/TypeTools.hx:203: characters 19-37 : Called from

I am identifying atm what is happening but I think I can imagine what example would cause this. I think this can be fixed by passing a cache array of complex types around these functions.

Trying to build with r6231

with typedef Hash = Map<Int,String>, TIntHash and tinkering with ExprTools.cond not matching on ExprOf, and other bits, this is what I'm getting:

src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/lang/Cls.hx:4: characters 3-12 : Build failure
tests/src/TestAll.hx:6: lines 6-19 : Defined in this class
src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/lang/Cls.hx:4: characters 3-12 : type has no fields
src/tink/reactive/bindings/BindableMap.hx:39: characters 3-31 : tink.reactive.bindings.BindableMap<tink.reactive.bindings.BindableMap.K, tink.reactive.bindings.BindableMap.V> has no field bindings
src/tink/reactive/bindings/BindableMap.hx:41: characters 3-30 : tink.reactive.bindings.BindableMap<tink.reactive.bindings.BindableMap.K, tink.reactive.bindings.BindableMap.V> has no field bindings
src/tink/reactive/bindings/BindableMap.hx:42: characters 2-29 : tink.reactive.bindings.BindableMap<tink.reactive.bindings.BindableMap.K, tink.reactive.bindings.BindableMap.V> has no field bindings
src/tink/reactive/bindings/BindableMap.hx:51: characters 4-31 : tink.reactive.bindings.BindableMap<tink.reactive.bindings.BindableMap.K, tink.reactive.bindings.BindableMap.V> has no field bindings
src/tink/reactive/bindings/BindableMap.hx:52: characters 4-31 : tink.reactive.bindings.BindableMap<tink.reactive.bindings.BindableMap.K, tink.reactive.bindings.BindableMap.V> has no field bindings
src/tink/reactive/bindings/BindableArray.hx:13: characters 2-29 : tink.reactive.bindings.BindableArray<tink.reactive.bindings.BindableArray.T> has no field bindings
src/tink/reactive/bindings/BindableArray.hx:14: characters 2-29 : tink.reactive.bindings.BindableArray<tink.reactive.bindings.BindableArray.T> has no field bindings
src/tink/reactive/bindings/Binding.hx:217: characters 74-89 : tink.collections.maps.StringMap does not have a constructor
src/tink/reactive/bindings/Binding.hx:217: characters 74-89 : tink.collections.maps.StringMap does not have a constructor
src/tink/reactive/bindings/Binding.hx:218: characters 65-77 : tink.collections.maps.IntMap does not have a constructor
src/tink/reactive/bindings/Binding.hx:218: characters 65-77 : tink.collections.maps.IntMap does not have a constructor
tests/src/reactive/BindingsTest.hx:22: characters 11-20 : Cannot access private field summand
tests/src/reactive/BindingsTest.hx:28: characters 11-19 : Cannot access private field factor
tests/src/reactive/BindingsTest.hx:45: characters 2-19 : Cannot access private field summand
tests/src/reactive/BindingsTest.hx:45: characters 2-19 : Cannot access private field summand
tests/src/collections/MapTest.hx:74: characters 29-38 : tink.collections.maps.IntMap does not have a constructor
tests/src/collections/MapTest.hx:75: characters 29-49 : tink.collections.maps.StringMap does not have a constructor
src/tink/reactive/bindings/Binding.hx:218: characters 65-77 : tink.collections.maps.IntMap does not have a constructor
src/tink/reactive/bindings/Binding.hx:217: characters 74-89 : tink.collections.maps.StringMap does not have a constructor
src/tink/collections/maps/IntMap.hx:12: lines 12-21 : Field exists needed by tink.collections.maps.Map is missing
src/tink/collections/maps/IntMap.hx:12: lines 12-21 : Field get needed by tink.collections.maps.Map is missing
src/tink/collections/maps/IntMap.hx:12: lines 12-21 : Field iterator needed by tink.collections.maps.Map is missing
src/tink/collections/maps/IntMap.hx:12: lines 12-21 : Field keys needed by tink.collections.maps.Map is missing
src/tink/collections/maps/IntMap.hx:12: lines 12-21 : Field remove needed by tink.collections.maps.Map is missing
src/tink/collections/maps/IntMap.hx:12: lines 12-21 : Field set needed by tink.collections.maps.Map is missing
src/tink/collections/maps/StringMap.hx:15: lines 15-24 : Field exists needed by tink.collections.maps.Map is missing
src/tink/collections/maps/StringMap.hx:15: lines 15-24 : Field get needed by tink.collections.maps.Map is missing
src/tink/collections/maps/StringMap.hx:15: lines 15-24 : Field iterator needed by tink.collections.maps.Map is missing
src/tink/collections/maps/StringMap.hx:15: lines 15-24 : Field keys needed by tink.collections.maps.Map is missing
src/tink/collections/maps/StringMap.hx:15: lines 15-24 : Field remove needed by tink.collections.maps.Map is missing
src/tink/collections/maps/StringMap.hx:15: lines 15-24 : Field set needed by tink.collections.maps.Map is missing

how to fixed Array<Array<haxe.macro.Expr>> has no field toArray

case
I want to put all args into one array in forward.hx;

var argsRemoting = callArgs.slice(0, callArgs.length - 1);
argsRemoting.push( { id:id, name:name } .toExpr() );
var argsRemoting2 = [];
argsRemoting2.push(argsRemoting);

    var call = callExpr.substitute( { 

        "$argsRemoting":argsRemoting2.toArray(),
        "$args": callArgs.toArray(),
        "$id": id.toExpr(),
        "$name": name.toExpr()
    });

///-----------------------------------------

"$argsRemoting":argsRemoting2.toArray(),//this is error and throw
src/tink/lang/macros/Forward.hx:138: characters 19-40 : Array<Array<haxe.macro.Expr>> has no field toArray

how to fixed?thanks

@:read should be supported by @:forward

class LevelSpec
implements tink.lang.Cls {
@:read var ltype:Int = _; // only works with @:prop, not @:read.
}

class Level
implements tink.lang.Cls {
@:read var index:Int = _;
@:forward( ltype ) var levelSpec:LevelSpec = _;
}

class Test {
public static function main() {
var ls = new LevelSpec( -1 );
var l = new Level( 0, ls );
trace( l.ltype == -1 ); // ./Test.hx:9: characters 4-11 : Method
set_ltype required by property ltype is missing
}
}

@:forward not support extern class

hello,@:forward not support extern class

because I use for js platform,so it will duplicate create std class ,so I want use extern instead real class ,
but @:forward not support
and haxe js not support separate each js file like haxe to php .

ExprTools.getIdent() also works on CType

This violates the principle of the least surprise: if getString() only works on CString and getInt() only works on CInt, then surely getIdent() can be assumed to only work on CIdent. If you want to support legit upper case identifiers and not introduce another get function, an optional bool argument could be used which determines if CType should be checked too. In my opinion this should default to false, but I'd be fine with a default CType support as long as I can disable it when needed.

question :Is that possible auto convert UInt to Int?

such like this code
#if flash
static public function createBitmap(Width:UInt, Height:UInt, Color:UInt, ?Unique:Bool = false, ?Key:String = null):BitmapData
#else
static public function createBitmap(Width:Int, Height:Int, Color:BitmapInt32, ?Unique:Bool = false, ?Key:String = null):BitmapData

every function need to write twice is waste..
I want width:@uint, Height:@uint,,is that possible?
thanks.

ShortLambda,Dispatch,DevTools not in repo

As far as I can tell

src/tink/macro/build/Member.hx:94: characters 10-18 : Unmatched patterns: this.isPublic = null
src/tink/macro/build/Member.hx:98: characters 10-17 : Unmatched patterns: this.isBound = null
src/tink/lang/macros/ClassBuilder.hx:89: characters 15-34 : Unknown identifier : ShortLambda
src/tink/lang/macros/ClassBuilder.hx:90: characters 15-34 : Unknown identifier : ShortLambda
src/tink/lang/macros/ClassBuilder.hx:93: characters 15-33 : Unknown identifier : Dispatch
src/tink/lang/macros/ClassBuilder.hx:94: characters 15-28 : Unknown identifier : Dispatch
src/tink/lang/macros/ClassBuilder.hx:95: characters 15-26 : Unknown identifier : Dispatch
src/tink/lang/macros/ClassBuilder.hx:108: characters 15-27 : Unknown identifier : DevTools
src/tink/lang/macros/ClassBuilder.hx:109: characters 15-31 : Unknown identifier : DevTools
src/tink/lang/macros/ClassBuilder.hx:110: characters 15-31 : Unknown identifier : DevTools
src/tink/lang/macros/ClassBuilder.hx:89: characters 15-34 : Invalid field access : process
Aborted

confusing error message when missing type in init during def

class Test
implements tink.lang.Cls {
var x:Int = _;
var y = x+1; // y:Int fixes it.

static function main() {
var t = new Test( 2 );
trace( t );
}
}

haxe -main Test -neko n.n -lib tink_lang
./Test.hx:4: characters 10-11 : Unknown identifier : x
/usr/lib/haxe/lib/tink_lang/0,2,4/tink/lang/Cls.hx:10: characters 3-12 : Build failure
./Test.hx:3: characters 14-15 : Unknown identifier : _
./Test.hx:4: characters 10-11 : Cannot access x in static function

TypeTools.asTypePath() doesn't really return a TypePath

TypeTools.asTypePath() does actually return a ComplexType which happens to be a TPath. This is a bit misleading because one would expect to be able to use ENew("pack.Name".asTypePath(), []).

I would prefer the TypePath structure itself to be returned so it can be used for ENew and in other situations where a real TypePath is needed. If you want to keep the current behavior, the method name should be changed to asComplexType.

error with AST.Build

#if macro 
import haxe.macro.Expr;
import tink.macro.tools.AST;
#end

class Main {

  @:macro static public function setter(e:Expr, field:String) {
      return AST.build( {
          var tmp = $e;
          function (v) {
              return $e.eval__field = v;
          }
      });
  }

  public static function main(){
    var o = { foo: 5 };
    var s = setter(o, 'foo');
  }

}

with this code i have this error:

tink/macro/tools/Printer.hx:57: characters 9-18 : This constructor is not part of the enum haxe.macro.ComplexType
tink/macro/tools/Printer.hx:159: characters 10-20 : This constructor is not part of the enum haxe.macro.ExprDef
tink/macro/tools/Printer.hx:138: lines 138-236 : String should be Void
tink/macro/tools/Printer.hx:51: characters 4-8 : String should be Void

Is for haxe 2.0.8 Optional arguments in type?

methods sometimes don't get forwarded

sometimes it fails to carry over certain things. so far has always
been methods, haven't seen it fail with vars. i even had a case where
it was working and then i have been doing major rework and it stopped
working. and then if i explicitly just add the field it works.

class X implements Cls {
@:forward var y:Y = _;
public function foobar() {
callAMethodOnY(); // compile fails with "unknown identifier :
callAMethodOnY"
y.callAMethodOnY(); // works
}
}

@:forward generate with default args

It would appear that default args on the function that is being forwarded to are not declared in the generated wrapper function, resulting in the default arguments not being executed with, in the forwarded-to function. It would appear for Ints, 0 is sent instead of the default argument.

Replace parameters with impl parameters

Hey, just wanted to offer this code which might be useful in having in the toolkit:

function replace_args_with_params(arg_complex_type:ComplexType,impl_complex_type_params:Array<TypeParam>,
    class_type_params:Array<{t:Type,name:String}>):Void {
    switch(arg_complex_type) {
        case TPath(p):
            var i:Int=0;
            for(class_type_param in class_type_params) {
                if(p.name==class_type_param.name) {
                    break;
                }
                i++;
            }
            if(i<class_type_params.length) {
                var impl_param:TypeParam=impl_complex_type_params[i];
                switch(impl_param) {
                    case TPType(impl_param_complex_type):
                        switch(impl_param_complex_type) {
                            case TPath(impl_param_path):
                                p.name=impl_param_path.name;
                                p.pack=impl_param_path.pack;
                                p.params=impl_param_path.params;
                                p.sub=null;
                            default:
                        }
                    default:
                }
            }
            for(param in p.params) {
                switch(param) {
                    case TPType(param_complex_type):
                        replace_args_with_params(param_complex_type,impl_complex_type_params,class_type_params);
                    default:
                }
            }
        default:
    }
}

You have a function(constructor) that requires parametrized arguments:

class <T,T2> {
     new(v:T,v:T2)
 }

You want to generate a second function (singleton constructor) that outputs Class<MyT,MyT2> and so would require an argument signature that is identical to the original function except with the implementation parameters substituted:

function singleton(v1:My2,v2:MyT2):Class<MyT,MyT2>

Of course there are more general forms of the above considering that functions can be parametrized in haxe.

Perhaps there are other forms of this type of thing that might be interesting to explore to its logical conclusion.

renaming when forwarding

i wish there were (i didn't see such a think in the docs) a simple concise way to rename things for forwarding, like:
class pdq implements tink.lang.Cls { @:forw (foo=bar) var xyz; }
means:
pdq.foo calls xyz.bar.

Strange completion issue when using tink_macro

I have the following (greatly simplfied) class and method, where I want to retrieve completions:

import MacroClass;

class Test {
    static function main() {
        var m = new MacroClass(); // delete either this line
        var x = 'hi'; // or this one, and it will work. 
        MacroClass.func(4). // trigger completion here.
    }
}

When I trigger the completion after MacroClass.func(m).|, I get back a single "unknown" type value from the compiler.

Strangely enough, if I delete the "x" variable declaration it works. Or, if I delete the constructor variable declaration, it works. Also, if I delete the import of TypeTools, it will work. Here's the MacroClass class from above. It just returns a macro'd string, and I'd expect to see relevant completions for string methods as completion candidates:

#if macro
import haxe.macro.Expr;
using tink.macro.tools.TypeTools; // commenting this out also makes completion work in Test.hx
#end

class MacroClass {
    public function new(){}
    macro public static function func(arg:Expr):Expr{
        return macro 'hi';
    }
}

Also, here's a simple build file that will pull this together:

-main Test
-x out 
-lib tink_macro
-lib tink_core

I'm on haxe 3 fwiw.

Which licence?

Hey just wondering which licence this code is under? It would be good if it was in there with the source.

Nice library!

Mike

@:require metadata not honoured in @:forward.

Using syntactic delegation on TextField in flash triggers a compiler error even when using (field0,field1...fieldn). I assume it's the TextInteractionMode field, but it may be something further up the class hierarchy.

Accessing this field requires flash version 11 (use -swf-version 11)

question about generate function with parameters

import test.test.Testx;

using tink.macro.tools.MacroTools;

class Main {
static function main() {

//src/Main.hx:14: characters 2-14 : Invalid number of type parameters for test.test.Testx
 times_tink();

}   

//the tink way
@:macro static function times_tink():Expr {



    var inst = ENew( { pack:["test","test"], name:"Testx", params:[TPType("hello".asComplexType())] }, []).at();


    return  inst;

}  

}
/**

  • package test.test;

class Testx
{
public var a = 1;
public function new(?target:String)
{
trace("hello--"+target);
}

}
**/

what's wrong with my caller?thanks.

@:forward through 2 levels fails

pseudo code extracted from larger project:

class LevelSpec implements Cls { @:read var x = _; }
class RunningLevel implements Cls { @:forward var spec:LevelSpec = _; }
class Drawer { function foo(r:RunningLevel) { trace( r.x ); }

gives "RunningLevel has no field x"

this is like issue 19 but a different error message, at least.

Some Error

I got this error, what is it?

/usr/lib/haxe/lib/tink_macros/0,2,2/tink/macro/tools/TypeTools.hx:92: characters 10-15 : This constructor is not part of the enum haxe.macro.Type
/usr/lib/haxe/lib/tink_macros/0,2,2/tink/macro/tools/TypeTools.hx:84: lines 84-103 : haxe.macro.ComplexType should be Void
/usr/lib/haxe/lib/tink_macros/0,2,2/tink/macro/tools/TypeTools.hx:84: lines 84-103 : Void should be haxe.macro.ComplexType
/usr/lib/haxe/lib/tink_lang/0,1,0/tink/lang/macros/Forward.hx:138: characters 4-11 : Missing ;
/usr/lib/haxe/lib/tink_lang/0,1,0/tink/lang/macros/Forward.hx:138: characters 11-12 : Unexpected :
/usr/lib/haxe/lib/tink_lang/0,1,0/tink/lang/macros/Forward.hx:138: characters 11-12 : Unexpected :

Feature request: Explain creating types

Hi
This is not really an issue but...

I'm wondering if you could update the wiki about creating types. I'd like to do some kind of mocking framework. Umock seems old and doesn't really work for me. I'd just like to know if tink would be an option for me in that work.

tink_reactive not so reactive

Hmmm in your example, the Binding Example (https://gist.github.com/2029110), when I trace the ticker value, it differs from the display.
I change the Ticker class to this

class Ticker implements Cls {
@:bindable var tick:Int = 0;
public function new(tickRate:Int) {
var t = new Timer(Std.int(1000 / tickRate));
t.run = function () // I change this
{
tick++;
trace(tick); // I trace from this
}
}
}

when it traces 3, the display show 2, somehow it is late...
I have tried it before, it display the incorrect thing...
I think when we use manually fire the signaller, it produces correct thing

Using the traitish thing, came across this.

import tink.lang.Cls;
import haxe.rtti.CType;

class ClsPatternMatchingTest {
  public function new(){}
  public function test(u){
    var a = new ImplUsingPatternMatchingThing();
    return u;
  }
}
interface UsingPatternMatchingThing implements Cls{
  //ok
  public function apply(v:WithParams):Void{
    switch (v){
      case Without    :
      case With(a,b)  :
      trace(a);
      trace(b);
    }
  }
  //not ok
  public function applyC(v:CType):Void{
    switch (v){
      case CUnknown:
      case CEnum( name , params ) :
      default                     :
    }
  }
}
class ImplUsingPatternMatchingThing implements UsingPatternMatchingThing{
  public function new(){}
}
//needs to go in separate file
enum WithParams{
  Without;
  With(a:String,b:List<Int>);
}

produces

C:\world\stack\prj\tinkerbell\src/tink/lang/macros/loops/LoopSugar.hx:451: characters 11-17 : Invalid field access : index
C:\world\stack\prj\tinkerbell\src/tink/lang/macros/Syntax.hx:25: characters 7-14 : Called from
C:\world\stack\prj\tinkerbell\src/tink/lang/macros/Syntax.hx:44: characters 48-58 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/ExprTools.hx:444: characters 12-15 : Called from
C:\world\stack\prj\tinkerbell\src/tink/lang/macros/Syntax.hx:44: characters 48-79 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/ExprTools.hx:224: characters 21-35 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/ExprTools.hx:221: characters 10-53 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/ExprTools.hx:302: characters 28-36 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/ExprTools.hx:356: characters 12-31 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/ExprTools.hx:236: characters 30-64 : Called from
C:\world\stack\prj\tinkerbell\src/tink/lang/macros/Syntax.hx:44: characters 9-86 : Called from
C:\world\stack\prj\tinkerbell\src/tink/lang/macros/Syntax.hx:41: characters 9-21 : Called from
C:\world\stack\prj\tinkerbell\src/tink/lang/macros/Syntax.hx:36: characters 79-95 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/Bouncer.hx:29: characters 5-24 : Called from
C:\world\stack\prj\tinkerbell\src/tink/macro/tools/Bouncer.hx:47: characters 27-49 : Called from
src/test/haxe/ClsPatternMatchingTest.hx:22: lines 22-28 : Called from

very recent svn, compiled with -D haxe3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.