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

[FEATURE] Simplify FormalParam #656

Closed
konnov opened this issue Mar 17, 2021 · 0 comments · Fixed by #724
Closed

[FEATURE] Simplify FormalParam #656

konnov opened this issue Mar 17, 2021 · 0 comments · Fixed by #724
Assignees

Comments

@konnov
Copy link
Collaborator

konnov commented Mar 17, 2021

We have the following three definitions to express operator parameters:

/**
 * A formal parameter of an operator.
 */
sealed abstract class FormalParam extends Serializable {
  def name: String

  def arity: Int

}

/** An ordinary formal parameter, e.g., x used in A(x) == ... */
case class SimpleFormalParam(name: String) extends FormalParam with Serializable {
  override def arity: Int = 0
}

/** A function signature, e.g., f(_, _) used in A(f(_, _), x, y) */
case class OperFormalParam(name: String, arity: Int) extends FormalParam with Serializable {}

It is not clear to me why the parameters are so complex. We can have one class instead:

class OperParam(name: String, arity: Int) extends Serializable {
  def isHigherOrder: Bool = arity > 0

  /* override equals and hashCode */
}

This refactoring will touch a lot of code. But we should do it after having integrated the type checker.

@konnov konnov added this to the April iteration milestone Mar 17, 2021
@konnov konnov mentioned this issue Mar 25, 2021
konnov added a commit that referenced this issue Apr 10, 2021
@konnov konnov mentioned this issue Apr 10, 2021
4 tasks
@konnov konnov assigned konnov and unassigned Kukovec Apr 10, 2021
konnov added a commit that referenced this issue Apr 13, 2021
* closes #656: refactor FormalParam

* fix formatting

* fix the comments

* fix formatting

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

Successfully merging a pull request may close this issue.

2 participants