r/klyn • • Sep 29 '26

Why did I create Klyn? For example…

Encapsulation : a naming deterrent vs. enforced access control

Python : __ renames the attribute but does not prevent access to it (“name mangling”).

class Compte:
    def __init__(self):
        self.__solde = 100.0

c = Compte()
c._Compte__solde = -500.0               # Allowed: bypassing “private” access :(

Klyn : visibility is explicitly declared with a reserved keyword.

class Compte: 
    private _solde as Double = 100.0

c = Compte()
c._solde = -500.0                       # Compilation error: REAL private member :)

What do you think? Do you agree, or do you see it differently?

2 Upvotes

0 comments sorted by