Hacker Newsnew | past | comments | ask | show | jobs | submit | more phpnode's commentslogin

Cool article. I'm the author of https://github.com/codemix/babel-plugin-typecheck mentioned and the next version of the plugin (WIP) takes this kind of approach, so that you can reference a type at runtime:

    type User = {name: string, isAdmin: boolean};

    // compiles to
    const User = t.object(
      t.property('name', t.string()),
      t.property('isAdmin', t.boolean())
    );

    // which you can then use with
    User.check({name: 'Alice'}); // boolean
    User.assert({nom: false}); // throws

Ultimately it should be possible to use this to implement pattern matching in JS based on flow types, for example:

    type User = {
      name: string;
      roles: Role[];
    };

    type Role = {
      id: number;
      name: string;
      users: User[]
    };

    const url = match(someInput, 
      (user: User) => `/users/${user.name}`,
      (role: Role) => `/roles/${role.id}`,
      (_) => `/` // default URL
    );
The really hard thing is to do this whilst maintaining perfect compatibility with flow.


It's a full dress rehearsal, the only difference between static fire and a real launch is that they do not release the hold-down clamps and shut down the engines instead. The cameras would have been rolling.


> Aren't the Babel people trying to define a common standard format for the AST so different parsers and code generators can better work together?

Actually kind of the opposite - babel used to use the common ESTree AST format, but they've moved away to something similar but incompatible.


It's not a random sequence of characters, there are only 12 words in there. The cracker is trying words, not just random bytes and so the search space is much smaller


It's not trying random words, it's not even trying random syntactically valid English sentences, it's trying out song titles.

Which is a laughably tiny password space.


Yes, it's not brute-forcing then. That's what I was getting at.


Rainbow tables aren't really a thing any more, you can calculate a hash much faster than you can download one


That's a very different attack vector to the one in this post - buffer overflow vs legit service running on open ports unbeknownst to the user


Still waiting for you to make good on this promise :)


GDC = Global Development Centre


We're all here to learn, if you've got some insight into what the article got wrong then why don't you school us?



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

Search: