Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sorry, typo

>> Yes, <typo>they</typo> replace<typo>d</typo> "function" usage with safe alternatives. And don't forget 'use strict' - it affected "function" too.

> I'm not convinced at all

It could appear I've tried to convince you not to use "function". That never was the case, should have added at least one. And I do not agree with TC39 direction, just making observations. Please check my comment assuming that and typo.

My fix would be different. Prototype based inheritance is awesome http://iolanguage.com/tutorial.html and javascript could be as simple too:

    Object
    Object.__proto__ === null

    object = new Object
    object.__proto__ === Object
    object.constructor === Object.constructor
    object.toString === Object.toString

    f = new Function
    f.__proto__ === Function
    fun.constructor === Function

    object.private = function () { return 'hello' }
    Object.shared  = function () { return 'world' }
    Object.constructor.static = function () { return '!' } // we need functions
with just a simple change

    Object = Object.prototype
    Function = Function.prototype

    syntax new = function (ctx) {
      let ident = ctx.next().value
      return #`new ${ident}.constructor`
    }
It looks almost boring (just don't redefine .constructor). Now this one is much harder:

    Object.prototype
    Object.prototype.__proto__ === null

    object = new Object
    object.__proto__ === Object.prototype
    object.constructor === Object
    object.toString === Object.prototype.toString

    fun = new Function
    fun.__proto__ === Function.prototype
    fun.constructor === Function

    object.private = function () { return 'hello' }
    Object.prototype.shared  = function () { return 'world' }
    Object.static = function () { return '!' } // we need functions


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: