Git Product home page Git Product logo

jstrict's People

Contributors

ahnzaz avatar

jstrict's Issues

Object.defineProperty()를 통한 field setting intercept

Object.defineProperty() 메소드를 이용하면 field에 직접 값 세팅하는 로직에 intercept가 가능하다. 게다가 해당 getter, setter 메소드에 해당 object가 this로 binding되기에 prototype tracking이 가능한 것으로 확인했다.

이를 이용하면 Prototype Chain을 상속구조로 사용하는 현재 구조에서 해당 필드의 알맞은 위치로 값을 이동시켜 줄 수 있을 것으로 기대된다.

예컨데 public scope에 존재하는 field라면 private, protected scope에서는 해당 값의 get, set을 상위 prototype으로 위임하면 결과적으로 public에 도달하여 해당 field에 적용될 것으로 예상한다.

다만 다른 두 개 이상의 scope에 동일한 이름의 field가 정의되어 있을때의 동작에 대해서는 고민이 필요하다.

Public Scope instance 생성의 문제

현재 코드에서는 new Class()로 생성되는 인스턴스들은 최종 결과물의 Public Scope instance만 반환이 되고 Private, Protected scope는 내부적으로만 존재하는 상황이다.

이런 상황에서는 Public Method, Field의 작동에는 문제가 없으나 다른 클래스로 핸들했을 때 protected 이하 field, method에 접근이 불가능한 문제가 있다.

그렇다면 결국 반환되는 instance는 private scope를 반환하고 호출되는 시점에 caller를 확인해서 처리 해야 하는데 문제는 제대로 된 caller를 알 수가 없다는 것이 문제다.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.