HNHacker News
TopNewBestAskShowJobs

justinmchase

261 karma · joined October 18, 2018

http://justinmchase.com
submissionscomments
justinmchase··on TypeScript please give us reflection/runtime types
It would be nice if the runtime validation was an ecmascript feature designed in such a way that typescript could infer the types for them automatically... Such as

    schema Example { ... }
    cosnt example: Example = new Example(unkonwnData)
Where a schema applied runtime validation based on declarative syntax and which typescript could use to derive a `type` from
justinmchase··on TypeScript please give us reflection/runtime types
I mostly agree, having every single type checked all the time like other static languages is not appropriate and probably not even a good idea but on the other hand it is also kind of annoying to have your validation code be divorced from your types totally.

For example suppose I have a web request coming in and I have essentially just a string of input coming in on the body. I have an expectation of what it needs to be but there is a step where it is of type `unknown` and I need to convert it into `IMyHandlerInput`. Just casting it is obviously a bad idea and so now I need to essentially use some kind of library such as ajv to do json schema or jtd validation, _then_ I can cast it into my interface.

This is all fine but it definitely feels redundant to me. It would be a cool _ecmascript_ feature to essentially support, not runtime types per-se but syntactic _validation_ which can also be used by typescript to derive types automatically.

This is totally hypothetical but I'm imagining something like this for example:

```ts schema Example { @min 0 id: number

  @pattern /^\w+ \w+$/
  name: string

  @future
  expiresAt: Date
}

const data: Example = new Example(JSON.parse(body)) ```

Something that the JS runtime can use to allow developers to opt-in to extensible validation which can also be used by the typescript interpreter to essentially derive types.

justinmchase··on Deno 1.27
It did still partially work but there was some friction with resolving types from ESM modules. For example in typescript+node if you're importing another module with esm you'd still have to import javascript like so:

``` import { Example } from "./example.js" // the actual file is example.ts ```

While in Deno you actually import the typescript file ``` import { Example } from "./example.ts" ```

That difference alone was enough to trip up the built-in typescript language tool and add friction.

Another thing is that Deno has a built in formatter / linter, you don't use a 3rd party tool like eslint, so having the ide just know how to do the linting and formatting is nice, the default typescript language plugin can't do that.

Also, Deno formats other file types including json, yaml and markdown.

justinmchase··on Deno 1.27
I have nothing bad to say about the other two but Deno is pretty great, I'm hoping it topples node.js at least, it seems poised to do so. Really lookin forward to playing with deno deploy too.
justinmchase··on A top scientific journal places political correctness above the search for truth
Oh you're not being sarcastic.

Social science without social justice would probably just be science, with social justice it would not be science but political activism, bias and probably ultimately would lead to something more detrimental than what they're trying to prevent.

How it should be is accurate and truthful. The problem with trying to prevent "potential harms" is that the term is subjective and suppressing the truth for subjective reasons will cause a non-scientific result which can be even more harmful in the end.

justinmchase··on How fat does a fat binary need to be? (2021)
Essentially it comes with a garbage collector which gets embedded into your binary as well as any other standard library calls you may need for fundamental features.
justinmchase··on Netflix to Employees: If you don't like our content, you can quit
The OA is amazing... to bad they cancelled it!
justinmchase··on Netflix to Employees: If you don't like our content, you can quit
You don't need to seem much to realize the movie is sick and if you watched it and didn't think it was sick then there's something wrong with you.
justinmchase··on Netflix to Employees: If you don't like our content, you can quit
Its not a great movie, you don't need to see the whole movie in order to see enough to realize its fucking sick.
justinmchase··on Netflix to Employees: If you don't like our content, you can quit
Not correct, it harms people and they attempt to convert others which can result in harm to your family and friends.
justinmchase··on Study conspiracy theories with compassion
Yes of course. If people don't want democracy anymore what would be a better way to end it than with a vote?

Also though, just because he wins doesn't mean he can actually deliver that promise. Most democracies have multiple layers of laws that would have to be passed after the election and would probably result in civil war without a super majority.

justinmchase··on Big tech makes a big bet: Offices are still the future
The are very susceptible to the fallacy of sunk costs.
justinmchase··on Big tech makes a big bet: Offices are still the future
Buy real-estate outside of the city.
justinmchase··on Big tech makes a big bet: Offices are still the future
We park in an open team chat for hours at a time. And by open I mean its unscheduled, open for any dev and people just pop in and out as they desire. Someone is always screen sharing and we work on problems together, a new person can absorb or drive things, get realtime feedback. You can popout and just focus as needed, its casual.

Sort of like discord but its code instead of games.

justinmchase··on One in three young people say they felt happier during lockdown
Maybe this isn't what you want to hear but never waste time on someone who doesn't want to be with you.
justinmchase··on One in three young people say they felt happier during lockdown
I can't know your full situation but I'd like to think its still very possible!
justinmchase··on One in three young people say they felt happier during lockdown
That's a weird way of saying 2/3 people didn't feel happier.
justinmchase··on CR+LF Has a Long History
Well you could if you have a line-unfeed. So by default it would do both but then in the uncommon case where you want overtype you could go back up.

A little late for that insight, if its even worthwhile, but typically I would optimize the common case by default and add features for doing advanced / uncommon things.

justinmchase··on CR+LF Has a Long History
Is your text modeling a text document or is it sending instructions to a terminal?
justinmchase··on CR+LF Has a Long History
And hopefully a short future!
justinmchase··on Django: Reformatted code with Black
You can see both of course. That's the beauty of history.
justinmchase··on Django: Reformatted code with Black
The output does look better but this also just looks like every PR for applying a linter / formatter I've ever seen. Not sure why this is news worthy.
justinmchase··on [dead]
I feel like not embedding the browser component is worse. Why would they go that route?
justinmchase··on Blame Cronyism, Not Capitalism
Regulation implies regulators, and regulators can become a bottleneck for power. They can demand bribes and favors in exchange for being allowed to operate and they can use their power to selectively eliminate political opponents sources of power.

Read "The Path to Power", LBJ biography. They describe this process plainly and how he continuously used his across his entire career in this way. Its very enlightening.

justinmchase··on Blame Cronyism, Not Capitalism
The level of competition is such that you have to complete across multiple lifetimes. You happen to be in a large bucket with a lot of competition you have to be top 1% in that case to even go up to the next level, which includes successfully having children and putting them on a good path to be top 1% as well. Take risks and succeed.

The game is incredibly competitive and challenging and just understanding that is difficult.

justinmchase··on Blame Cronyism, Not Capitalism
In Plato's ideal republic the lawmakers, or protectors, were instead removed from society living in a parallel society dedicated to service. Therefore they would be incorruptable, or difficult to corrupt.
justinmchase··on Who wrote this shit?
On the other end, it's fun when you encounter a bug and go search for an answer and end up reading an answer on Stack Overflow that _you wrote_ 5 years ago and totally forgot about it.
justinmchase··on How to Lose Stars on GitHub?
> ... we don't track stars on our end...

This seems false, clearly they're stored in their database. This seems like a response from someone who doesn't exactly know what he's talking about. Perhaps they are deleted but there is certainly a backup someone could find the data in.

Keep pushing.

justinmchase··on Ask HN: Has Google search become quantitatively worse?
Perfectly stated.
justinmchase··on Ask HN: Has Google search become quantitatively worse?
Not just that but bias, they intend to promote certain content and demote others and that introduction of human bias essentially dillutes the effectiveness of the algorithm; you don't get what you are searching for per-se but someones opinion of what you should get.
Page 1 of 5Next →