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

Can you give more info on how "parse, don't validate" has been helping you? I'm trying to get on the train, but I have so much validating code.


Not OP, but "parse, don't validate"[0] says that data (including config, etc.) should go through a "parsing step" (no "shotgun parsing"[1]) which outputs specific data-types for the main processing code to deal with ("invalid states should be unrepresentable"[2]).

For example, we might have a "parsing step" which takes in Bytes (e.g. '[{"email": "[email protected]"}]') and outputs a 'NonEmptyList[ContactDetails]' (e.g. 'NonEmptyList(Email(NonEmptyString('c', "hris"), NonEmptyString('e', "xample.com")), Nil)').

Compare this to a "validate" approach, e.g. parsing the bytes to a 'JsonArray', and using a boolean function to check whether it's empty, and whether its entries match the 'contact details' schema. That's problematic, since (a) it leads to "boolean blindness"[3] (the function tells us 'attempting to get those fields should work', whereas the parsing approach actually gives us those fields) and (b) such a boolean function is actually redundant, since deleting all of its call sites (or forgetting to write them to begin with) would give us a program that still compiles and runs (whereas the parsing approach would give a type error: 'Given JsonArray, expected NonEmptyList[ContactDetails]').

CUE's approach seems to be similar to passing JSON values around, and occasionally performing validation checks (if we remeber to); i.e. validating, not parsing.

[0] https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...

[1] http://langsec.org/brucon/ShotgunParsersBruCON.pdf

[2] https://fsharpforfunandprofit.com/posts/designing-with-types...

[3] https://existentialtype.wordpress.com/2011/03/15/boolean-bli...


Its not clear how this complaint applies to a configuration language, since there is no mutability or change, configuration is statically evaluated.

I'd consider cue to be a config language that by and large tries to make invalid states unrepresentable.


As a python dev, nim was much easier to get into than Go, Rust, or even Zig.

If you squint, it looks like a toddler Python with strong typing, compilation and a few different API, espacially for managing finalisation.


I may be splitting hairs here but Python is actually a strongly typed language. It would be better to say nim has static typing: https://wiki.python.org/moin/Why%20is%20Python%20a%20dynamic...


The internet in one comment, ladies and gentlemen.


And just like that, the outrage about the photo scanning malware Apple installed on their iPhone is forgotten.

"The screeching voices of the minority" indeed.


First of all, they never "installed" anything, it was a future feature. Second, they delayed it (possibly indefinitely) after the huge pushback.


I heard they reconsidered.


Well, if you want events, you have lighter alternative. Redis pub/sub, crossbar... Even rabbitMQ is lighter.

If you need queuing, you have libs like celery.

You don't need to go full kafka


I do not disagree. Kafka is kind of a monster to fully configure correctly. Once they get rid of zookeeper it may be nicer to spin up and 'set it and forget it' sort of thing like the others.


Redis - it's probably in your stack already and fills all the use-cases.


Agreed. Redis pub/sub is underrated.


Stream? Unless you have really hight traffic, put that in a python script while loop that regularly check for new rows, and it will be fine.

If you want to get fancy, db now have pub/sub.

There are use case for stream replication, but you need way more data than 99% of biz have.


You don’t want stream replication for scale, you want it for availability and durability. The number of times replication has saved my ass is too damn high.

And you want Kafka (or something like it) the moment you need two processes handling updates which again you probably want for availability reasons so a crash doesn’t stop the stream.

You also don’t catch deletes or updates with this setup. But there’s a million db to Kafka connectors that read the binlog or pretend to be a replica to handle this.


Sure, if you need high availability + replication cross db, go for Kafka, but that's the thread point: it's not a common use case.

Most people don't need high availability, and most replication use the same db which comes with tooling for that.


I think that's part of the plan to accelerate Python that the Microsoft team has.


I haven't followed this. What plans does Microsoft have? All I know is that they pulled out of PHP recently after supporting its development for quite a few years.



Thanks! (And oh, /. always has this historic vibe ...)


They didn't pull out, they used to provide a php windows build which is now handled by the community instead on azure resources donated by Microsoft


Sure they pulled out. They had different developers over time on their payroll and stopped that.


I'm the first person to complain about bloated electron apps, but this is a task that I do so rarely I really don't mind it's electron.

This is, btw, not really an alternative to etcher, more like an alternative to rufus or unetbootin.

Indeed, the reason they made etcher was because they had too many help requests from hobbyists trying to flash their raspi sd cards. So they made a candy UI, and the requests dropped.

The candy UI is the main goal of etcher, if you remove that, then why not use the already very fine existing solutions?


> I'm the first person to complain about bloated electron apps


Can we report this account? It has been opened 4 years ago, with 2 comments, including this one.


Why? It's not a great comment, but hardly offensive.


Because it looks like a bot, not a human being.

Hey, @nlarion, if you are not a bot, say so.


It is a solved problem. The entire world has solved this problem.

This is not a reason, this is a pretext.


You gotta find material for the next season of Black Mirror somehow.


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

Search: