Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic #2

Closed
kevinresol opened this issue Apr 14, 2016 · 8 comments
Closed

Dynamic #2

kevinresol opened this issue Apr 14, 2016 · 8 comments

Comments

@kevinresol
Copy link
Member

I think Dynamic (without type parameter) should also be handled, we may simply pass a null to gen.dyn and let user handle it.

          case TDynamic(t):

            if(t == null)
                gen.dyn(null, null);
            else
                gen.dyn(gen.dynAccess(genType(t, pos)), t.toComplex());

For example, tink_json's GenWriter may be changed to:

  static public function dyn(e, ct) 
    if(e == null) throw "Dynamic without type parameter is not supported"; // add this line
    return macro {
      var value:haxe.DynamicAccess<$ct> = value;
      $e;
    }

Related: haxetink/tink_json#2

@back2dos
Copy link
Member

Just to be clear here: plain Dynamic is not handled in the Dynamic<T> branch, but one can handle it in rescue. Hope that works for you.

@kevinresol
Copy link
Member Author

@back2dos Thanks for the fix. Have been working on a runtime typecheck util and this lib really helped.
Btw, do you think it is a good enough util to be added to haxetink?

@back2dos
Copy link
Member

Oooh, very interesting! I had plans for such a thing myself, but you beat me to it :D

I'm very honored by your offer to add your code to tink. However, I must warn you that I am strongly attached to this project (i.e. tink as a whole) and the spirit I started it in - which I cannot properly verbalize to this day. Chances are that I will occasionally confront you with rather idiosyncratic decisions, that I just can't explain but "feel" to be right. From working with Nicolas, I know how frustrating this can be, so I do try hard to make it better. But still, I feel that I should caution you. Ultimately, like all approaches, collaboration has its own challenges and rewards. If you feel up to it, I'd be thrilled to welcome you aboard. If not, I understand perfectly.

Either way, your lib is really cool! ;)

@kevinresol
Copy link
Member Author

In fact, it is you beat me on this. I have this idea long time ago but I just don't have the skill to "make it right". Until I meet tink_typecrawler and tink_json, which give me the tool and example to finish it.

I truly understand that software designing is actually more art than science. Since I don't have much sense in this regard, I would be more than happy to hear comments from you.

btw, I am really really impressed by how useful yet simple and elegant the tink libraries are.

@back2dos
Copy link
Member

Well then, welcome to the club!

And also, thank you for your kind words :)

@kevinresol
Copy link
Member Author

Thanks! I transferred the repo, but after that I am unable to access the setting page to rename it...

@back2dos
Copy link
Member

Ok, I changed a couple of permissions. Can you please try again?

@kevinresol
Copy link
Member Author

Yes, it's ok now. Btw do you have any opinion on the repo name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants