Feature: `__` private members/name mangling in classes

Open
#853 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, python
Domain
compilers

Research direction

Start by reviewing the linked Python documentation on private variables and name mangling, then inspect how Transcrypt currently handles class members and mixins. No source files, tests, or entry points are named in the issue. Done would require an agreed implementation scope and tests demonstrating the expected mangling behavior in generated JavaScript.

Written by the indexing model from the issue text.

Description

IS: enhancement IS: exploratory

Sorry, I would expect that this probably documented but I just cannot find it:

https://docs.python.org/3/tutorial/classes.html?highlight=name%20mangling#private-variables

Short question: Is this supported in some way? Or are there plans to support it?

It seems to be such a core-feature of Python that I kind of feel stupid to ask, I would bet that it was decided to not implement that feature somewhere/somehow, but I cannot find a reference to that decision or if it even was made?

To me this would be a very awesome feature, because it is for me the feature that avoids naming collisions in classes for something like Class-Mixins. I am reviving an old project of mine which consists converting an old piece of Python code to a web-capable implementation, and this would make those conversion efforts a LOT more convenient.

Dominant language
Python
Stars
2.9k
Forks
218
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TranscryptOrg/Transcrypt

All issues in TranscryptOrg/Transcrypt

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.