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

Replace the NoteTag enum with a custom train which would be implemented by companion objects of all nodes #16

Open
letalvoj opened this issue May 5, 2021 · 0 comments
Labels
not-in-thesis Not worth spending time before the thesis is submitted

Comments

@letalvoj
Copy link
Collaborator

letalvoj commented May 5, 2021

Kdyby se nahradil

object IntoClause extends NodeDecoder[IntoClause](IntoClause.type) with NodeTag[IntoClause] {

kde ten string by sel ziskat markem / programaticky a NodeTag by byl

trait NodeTag[CC]{
  implicit def decoder:Decoder[CC]
}

object NoteTag{
  def withName(name:String):NodeTag = ??? // tohle by se jedine muselo naimplementovat... ale jelikoz je to runtime vec, tak by to klidne mohla byt reflexe ci co ...
}

tag by byl ten decoder svazanej s tim tagem a tim by se ti tenhle hroznej match

NodeTag.withName(key) match {
  case NodeTag.T_A_Const        => c.as[A_Const]
  case NodeTag.T_A_Expr         => c.as[A_Expr]
  // ... and many many more

zmenil na oneliner

  NodeTag.withName(key).decoder(c)
@letalvoj letalvoj added the not-in-thesis Not worth spending time before the thesis is submitted label May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-thesis Not worth spending time before the thesis is submitted
Projects
None yet
Development

No branches or pull requests

1 participant