HNHacker News
TopNewBestAskShowJobs

zkldi

1,734 karma · joined March 10, 2021

aspirant
submissionscomments
zkldi··on Ask HN: Any other self taught devs terrified of interviewing these days?
I've found it very difficult to find places that give a damn about personal projects or anything a self-taught developer can do.

If you're hiring and care about these things hit me up :)

zkldi··on I Avoid Async/Await
I don't get it then; your fix to promises being complicated is to remove the ability to perform asynchronous actions. That's cool for a small scripting language I guess, but absolutely impractical for anything serious.
zkldi··on I Avoid Async/Await
How would you allow running the fetches in

    fetch /some-url as json
    fetch /some-other-url as json

    do_stuff_with(result1, result2)
in parallel?
zkldi··on I Avoid Async/Await
they are. async functions sre just syntactic sugar for returning promises.
zkldi··on I Avoid Async/Await
I don't think it's a good practice, atleast if you have typescript jn your stack. It's redundant and wraps the promise in another promise.
zkldi··on Node.js packages don't deserve trust
There would be a significant performance impact if `.sort()` argumentless had to traverse the list and checked all inputs were numbers. It's better to pass a sort function -- that is how the API is meant to be used.

I agree that without an argument it should just be a fatal error, but if it were to have any sort of functionality, it should convert all to strings.

This is consistent among JS's apis, and pretty much the origin of all the 'js wut' moments on the internet. Everything in JS can be converted into a string. If you do something stupid with disparate types, it will likely turn operands into strings and compare them that way.

zkldi··on Node.js packages don't deserve trust
This reduces package-installing friction, but this is a good thing anyway -- there's no reason why you shouldn't be able to use foobar@1.0 and foobar@2.0 in the same project. For all intents and purposes they're different packages, viz. the version is just as important as the package name.
zkldi··on Node.js packages don't deserve trust
You aren't meant to put your own files manually inside node_modules. What are you trying to achieve with that?
zkldi··on Node.js packages don't deserve trust
This is absolutely not true, and I'm tired of seeing this.

is-odd, alongside a bunch of other microdependencies are almost all the work of one person, who made as many micropackages as possible and then PRd them into other more popular libraries. There are not 6 million people directly downloading `is-odd` a day. At all.

When this person could make one library to do something (like an ANSI-Colouring package), they would fractalise it into as many dependencies as possible, because that boosts their download count on NPM. I should note that this is just one person who has managed to nestle their way into some larger projects. I apologise for the spam, but this point really needs hammering home:

https://github.com/jonschlinkert/ansi-black

https://github.com/jonschlinkert/ansi-reset

https://github.com/jonschlinkert/ansi-bold

https://github.com/jonschlinkert/ansi-dim

https://github.com/jonschlinkert/ansi-italic

https://github.com/jonschlinkert/ansi-underline

https://github.com/jonschlinkert/ansi-inverse

https://github.com/jonschlinkert/ansi-hidden

https://github.com/jonschlinkert/ansi-strikethrough

https://github.com/jonschlinkert/ansi-black

https://github.com/jonschlinkert/ansi-red

https://github.com/jonschlinkert/ansi-green

https://github.com/jonschlinkert/ansi-yellow

https://github.com/jonschlinkert/ansi-blue

https://github.com/jonschlinkert/ansi-magenta

https://github.com/jonschlinkert/ansi-cyan

https://github.com/jonschlinkert/ansi-white

https://github.com/jonschlinkert/ansi-gray

https://github.com/jonschlinkert/ansi-grey

https://github.com/jonschlinkert/ansi-bgblack

https://github.com/jonschlinkert/ansi-bgred

https://github.com/jonschlinkert/ansi-bggreen

https://github.com/jonschlinkert/ansi-bgyellow

https://github.com/jonschlinkert/ansi-bgblue

https://github.com/jonschlinkert/ansi-bgmagenta

https://github.com/jonschlinkert/ansi-bgcyan

https://github.com/jonschlinkert/ansi-bgwhite

zkldi··on Node.js packages don't deserve trust
> Bizarre default sorting behaviour

You are meant to pass an argument to [].sort; If you don't, it falls back to the most generic thing that makes sense -- which is turning everything into a string and sorting lexicographically.

Arrays in JS can have any type in them, such as [number, string, function]. That's obviously very unlikely, but the only thing in common between all types in JS is that they can all be explicitly turned into strings.

And yes, I agree that throwing an error here for no argument would be better here (a linter WILL enforce this), but this is hardly a critical shortcoming of JS's standard library, and you DEFINITELY do not need a utility library just to use the language (especially for your examples).

zkldi··on $625M worth of ETH drained on Axie Infinity's Ronin Network
just a poke: it was 5K Eth ($16,924,050), not 5K USD, but i agree with your wager.
zkldi··on I wasted $40k on a fantastic startup idea (2020)
The MDN Plus release is probably the evidence you're thinking of.
zkldi··on Building a no-code toxicity classifier by talking to GitHub Copilot
> I wrote a comment outlining exactly what I wanted, and immediately Copilot generated the code I was after.

How do you know it was what you were after? Like you said, it could be .toLocaleTimeString or .toLocaleString (or something else).

How do you verify that the AI isn't giving you broken/incorrect code? I guess you could check the docs, or run the code yourself, but at that point what's the value add for copilot?

zkldi··on Nushell 0.60 Released
Been using this for a while now. It's very good, well designed and the right way (imo) to modernise the shell.

Bringing datastructures to the shell environment (instead of everything being strings) is just the right thing to do, and I've been personally interested in making binaries that can natively input/output these data structures.

big thanks to the team, this stuff is cool.

zkldi··on On the Weaponisation of Open Source
https://github.com/npm/rfcs/issues/509

it more or less just makes it difficult for updates to propogate, which is arguably a good thing.

zkldi··on Analysing the AI of Super Mario 64
I actually don't think videogame AI has gotten much better since Halo 1. Maybe that game was just incredibly ahead of the curve, or that's as good as we can do.
zkldi··on Write plain text files
If I piped that .docx file into bas64, would it then be a "plain file"? It's ascii plaintext chars.

I don't think your argument holds any water.

zkldi··on Fengari – Lua for the Browser
Fair enough -- Like I said, I think somewhere under the cruft of JS is a good language, but I don't think it's as bad as OP implies.
zkldi··on Fengari – Lua for the Browser
I don't personally think there's anything complicates about arrow functions. They're syntactic sugar for `function() {}`, with the exception that they have sensible binding of `this`.

I do agree that Lua is simpler, but I don't think this is an area where JS is that bad.

zkldi··on Fengari – Lua for the Browser
> People who are confused about equality shouldn't design programming languages:

This is a very dull criticism of JavaScript, everybody uses ===. While it's definitely true the language has some poor decisions (`with`, `==`, etc.). You can write JS without using any of these features (and almost everyone does).

Infact, just using a decently strict ESLint config will get you most of the way there.

It's controversial, but I think somewhere under the cruft of JS is a good language. The syntax is dead simple, functions are first class, and with something like TS you can get static typing ontop of all of that.

zkldi··on Feds arrest couple, seize $3.6B in hacked Bitcoin funds
jeez man, not every comment has to be a profound statement. I thought it was pretty interesting.
zkldi··on Some mistakes Rust doesn't catch
Been a firefox user forever and have never seen anything like this. What do the panics say? Have you reported this?
zkldi··on Some mistakes Rust doesn't catch
You can write a forkbomb in any language -- that's besides the point.

Some languages are easier to write broken code in than others.

zkldi··on An introduction to type programming in TypeScript

    [] - {}
is a fatal typescript error[0]. A well configured linter can also catch out similar nonsense, but [] - 2 does get past the compiler.

The TS Compiler can atleast stop you from doing nonsense like applying operators to types where they don't make sense. Of course, it'd be better if JS just threw an error or something, but atleast TS can stop you.

[0]: The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.ts(2363)

zkldi··on A pipe operator for JavaScript: introduction and use cases
Backwards Compatibility -- So much code out there depends that typeof null === "object".
zkldi··on Did I just lose half a million dollars?
Native, educated speaker here: Nobody cares and everybody understood what they meant.
zkldi··on Did I just lose half a million dollars?
So your definition for "valid action" is just that the eth network lets them do it?

They clearly didn't want to burn £500k, and that is now irrecoverable, alongside 260 other people who made the same mistake, on a smart contract that forgoes validation for gas fees.

How is this not invalid?

zkldi··on Deno in 2021
Sharing the types of API returns is very useful.
zkldi··on IETF should keep XMPP as IM standard, instead of Matrix
8.1. Character Encoding

   JSON text exchanged between systems that are not part of a closed
   ecosystem MUST be encoded using UTF-8 [RFC3629].
JSONs definition was improved in RFC8259 (2017) to mandate UTF-8.
zkldi··on IETF should keep XMPP as IM standard, instead of Matrix
> does it always use UTF8 or does it break the standard?

It always uses UTF8, or it is invalid JSON and MUST NOT be parsed. For the same argument against XML, you could argue whether it actually honours the encoding field (i've found many cases where things lie in the encoding field, and still parse fine by XML parsers)

> Which version of the JSON Schema does it use?

Quite literally the only one I have ever seen in use, ever, is JSON Schema[0].

> Is it using a schema at all?

Most often, no.

> What happens when "$ref" appears in the content body?

Nothing? JSON doesn't have lookups. There is no way to do lookups in JSON. If you do otherwise, you do not have JSON anymore.

> How should I deal with duplicate keys?

This is an actual, real issue with JSON.

XML is a terrible format. It's filled to the brim with footgun features like entity expansion (only ever used to DOS servers), no data types (everything is a string, your parser just needs to know better), no meaningful reason to have both attributes and content, ambiguity between an array of one element and an element, etc. etc. etc.

[0]: https://json-schema.org/

← PreviousPage 3 of 7Next →