Hacker News new | ask | show | jobs
by Talinx 812 days ago
Functions make assumptions all the time and there is often no way to specify them except with type information. E. g. one can specify that a function takes a float as input but not that the float has to be in [0.0, 1.0]. Hard to catch with static code analysis.

Idea for implicit parameters:

Implicit parameters are values from somewhere up the call stack. So make an object with a get function:

    Scope.get('Logger')
But then you can get anything. So add a mechanism to put things in there up the call stack:

    logger = Logger()
    Scope.put('Logger', logger)
That's a key-value store with scope levels.