Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Why not use private keyword instead of #? #8

@cathrinevaage

Description

@cathrinevaage

I'm sure you have taken this into account somehow, but I can't find discussion or reasoning for it in my research.

Why use the # prefix?
Why not use the private keyword?

I'd imagine you would use it somewhat like this:

class Foo {
  private bar() {
    // ...
  }

  constructor() {
    private.bar();
  }
}

Here we use the private keyword, both when defining the method, and when referencing the it.

As far as I can tell, this would solve the problem of having them being accessible on the instance of the class.

We already do something similar when referencing methods of a superclass, using the super keyword.

I find this to be more expressive, and more familiar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions