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

[cs] Added cs.StrictMeta #3503

Closed
wants to merge 2 commits into from
Closed

Conversation

waneck
Copy link
Member

@waneck waneck commented Oct 21, 2014

I'm submitting this as a pull request to request for comments - in special regarding:

  1. the naming of the strict macro (@M(SomeClass))
  2. If we could instead have a haxe.StrictMacro macro interface with about the same features

@nadako
Copy link
Member

nadako commented Oct 21, 2014

ouch, build-macros in std lib :-)

@ncannasse
Copy link
Member

Just wanted to know about the context : is this something CS specific or particularly useful for CS dev ?

@waneck
Copy link
Member Author

waneck commented Oct 21, 2014

All native attributes in C# are type checked. The current native
implementation of native attributes in Haxe (via @:meta) however doesn't
type check them. And because of that, it's pretty confusing to work with
native attributes via Haxe. For example, if you want to use
cs.system.SerializableAttribute in a class, you'd need to use its native
type representation : @:meta (System.SerializableAttribute).
This macro does this conversion and type checks it.
I'm open to suggestions on better ways to implement this. Despite this
relating in special to C# an Java, maybe we can come up with an unified
(standard) way to deal with type check metas across all targets.

On Oct 21, 2014 4:29 PM, "Nicolas Cannasse" notifications@github.com
wrote:

Just wanted to know about the context : is this something CS specific or
particularly useful for CS dev ?


Reply to this email directly or view it on GitHub.

@waneck
Copy link
Member Author

waneck commented Oct 21, 2014

@nadako, indeed maybe an ocaml implementation would be best ;) . But then I think it would make more sense to just consider any @M() metadata as a strict meta (not need the implements StrictMeta at all), and make this construct "reserved".

@nadako
Copy link
Member

nadako commented Oct 22, 2014

@M looks quite arbitrary to be honest, maybe is it better to add some new syntax, e.g. @[] or whatever.

@waneck
Copy link
Member Author

waneck commented Oct 22, 2014

If @ncannasse agrees to something like that, I will be happy to work on it.
Maybe my last messages were a little confusing, so I'll try to clear it up what's the purpose of this:

  • Both Java and C# (and possibly other targets - Flash maybe?) have native metadatas; They are however typed, and it is possible to import them, and necessary to type check them. In order to implement them correctly, we need to check them on the Haxe side as well.
  • I agree that a macro solution looks kinda bad. Maybe we could add a better support for it by making some special construct that will be checked on typeload. I'll be glad to work on this - but it is possible that a new syntax will be needed so they don't clash with any other metadata
  • In that sense, it would be great to add cross-target support for this, and add a mechanism to support this across all targets. I think this can become very useful, and even allow more macro possibilities (e.g. having a macro that gets activated when a special class is mentioned).

@Simn Simn added this to the 3.3 milestone Feb 22, 2015
@waneck
Copy link
Member Author

waneck commented Mar 2, 2015

Superseded by #3954 3954

@waneck waneck closed this Mar 2, 2015
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

Successfully merging this pull request may close these issues.

4 participants