Better HN
topnewbestaskshowjobs
Log inSign up

ImprobableTruth

1,706 karma · joined Dec 9, 2019 (6y ago) · 623 submissions

Submissions

comment 4y ago · link · parent

Human-language proofs for anything non-trivial are really just proof sketches, that's why you can't really meaningfully separate this into a two step process.

comment 4y ago · link · parent

There is no meaningful null check enforcement like with pattern matching, if you try to access the Option value and fail to handle the error correctly, you either get a panic (from the following null deref) or in this blogpost the zero initialized value (which is honestly worse than an instant crash).

>Furthermore, you can add functor and monadic APIs to `Option`

There's nothing preventing you from defining these functions directly on pointers, they'd be just as safe.

comment 4y ago · link · parent

An Option type without pattern matching is just as useless. Before unwrapping the value, you should check if its None and if you fail to do that, you get a panic. That's literally how pointers already work.

comment 4y ago · link · parent

The version history mentions the last update.

>1.4.4 Nov 3, 2017

comment 4y ago · link · parent

I think there's a good argument to keep terms to maintain the historical connection. There's a boatload of math and CS terms that are very, very poorly named, but if you renamed them, you lose the link to prior sources.

comment 4y ago · link · parent

I can't tell if you're joking, but the author previously explains that "double mouvement" is a french expression.

comment 4y ago · link · parent

Your initial statement was that the type system was a poor architectural choice because it doesn't support standard python idioms. To the best of my ability I've tried to communicate that there's an important difference between the type system and the standard library, that one can make it work and that the situation is not worse than most other typed languages.

If you think that's violently agreeing and talking down to you, then there must be some communication barrier that I don't know how to overcome.

comment 4y ago · link · parent

A decade or so ago JSON was changed so that JSON text doesn't have to be an object, it can also be a value. 'null' (or say, '5') is therefore legal JSON.

comment 4y ago · link · parent

This is (for now) a limitation of mypy, not of the type system. Pyright and Pyre both can type JSON since they support recursive type aliases.

comment 4y ago · link · parent

I think I might not have been clear: this is not a limitation of the type system, but of a specific type checker (mypy), that will hopefully be fixed soon. Both Pyright and Pyre support recursive type aliases right now. Open one of their playgrounds and you'll see that the following, intuitive definition

  JSON = Union[
      None,
      bool, 
      int,
      float,
      str,
      List['JSON'],
      Dict[str, 'JSON'],
  ]
works without issue.

>In fact, you admit that even fixed JSON can be difficult without a 3rd party library.

Sure, but that's just because the standard library (for now?) doesn't offer deserialization with runtime validation. Java doesn't have that either, if you want to parse JSON you'll have to either roll your own or rely on a third party library.

Don't get me wrong, the situation isn't perfect, but especially if you use the 'right' tooling, you can in my experience already get a perfectly serviceable experience, which to me is indicative that the type system itself is fine and pythonic, it's just the tooling that is lagging a bit behind at the moment.

comment 4y ago · link · parent

Sure, but the idea behind gradual typing is that 'Any' should only be temporary. IMO if you're serious about it, stable code should at least pass strict type checking, if not completely forbid even explicit Any.

>There’s a reason I brought up the JSON example: loading and manipulating JSON of varying structure is something I do a lot at work.

Do you have a specific example that you find troublesome? For JSON with a fixed, regular structure (i.e. no subtyping) something like Pydantic works well, otherwise using unions + protocols with custom validation code has covered even my most esoteric use cases so far.

If we're talking about unstable JSON, a recursive union type works well enough in my experience, though defining that type gets a bit ugly if your type checker doesn't directly support recursive types.

comment 4y ago · link · parent

I think the top comment was less polite than it should be, but I would echo that the post seems to have a bit of a weird understanding of gradual typing?

The Any type is to allow incremental typing. You start out with dynamic code, and progressively 'typify' it by adding more and more annotations, with Any working as a stopgap where for the moment no valid type exists, until you finally have a fully typed program. Inserting Anys because you're lazy is like casting things to Object in Java because you're lazy, abusing it like that is just incredibly sloppy and bad code.

If someone is really struggling with this, simply use a linting rule to ban Any in 'mature' code.

comment 4y ago · link · parent

Man, the idea that type hints reduce read-ability are crazy to me. It's like if someone told me that they think comments make code less readable.

Like, even if you think that type hints have ugly syntax, prior to them vast most projects just didn't bother with documenting the shape of data, so you had to read source code, guess and experiment. Unless you just don't care about knowing what you're specifically working with (which strikes me as living on the edge), how is it not an ergonomics gain?

comment 4y ago · link · parent

No offense, but have you actually given it a shot? Duck typing is supported and you can get virtually all use cases of heterogenous dictionaries by using union types and duck typing. The article even touches on this.

edit: To be more precise: The article specifically mentions that accessing invalid members give you a type error, but posits that people will probably not bother and just use 'any' instead. How is that not saying 'too much discipline'?

comment 4y ago · link · parent

I'm a hobbyist who tried switching and really didn't like having to use C++ or blueprints.

Epic is working on a new language called verse though, so that might change the situation.

comment 4y ago · link · parent

Since they're complaining about maintainability, I assume they're advocating for microkernels?

comment 4y ago · link · parent

I'm curious, how expensive is it to train these models? I wonder if it would be possible to crowdfund the training, especially if targeted at a group that is (at least stereotyped) as spendthrift as furries.

comment 4y ago · link · parent

Is "Nothing about this paper is new" an appropriate response when the abstract explicitly mentions that it's a survey paper? Maybe I'm just sensitive, but to me that sounds dismissive rather than purely informative.

comment 4y ago · link · parent

> async/await is more limited than `do` (or yield and coroutines in JS) it's a lot easier to create tooling for.

What kind of tooling are you referring to?

comment 4y ago · link · parent

If your work environment is reproducible this shouldn't be an issue. Nix works well for me personally.

Another boon is that if your system goes kaput for whatever reason, you've already done the legwork to immediately get up and running again.

comment 4y ago · link · parent

Sure, it's best to work with rather than against the language, but for most languages support of functional programming is not binary, just like with OOP.

I'm pretty sure most of the complaints are generally of the "This FP thing would work well here, but the language is unfortunately not quite there" nature rather than "I will try to implement profunctor optics in C no matter the cost" square peg in round hole crazyness.

>when you force lots of maps & filters in a language that can't do fusion and function calls are kind of expensive

I think that's perfect example to show that it's really about degrees, because fusion is really a Haskell thing. Sure, it's a nice-to-have, but it's definitely not essential to functional programming.

And when people want sum types (which aren't even really FP, ALGOL had them first!), it's often because the idiomatic alternative just kind of sucks for what they're doing. Trying to "implement" sum types in a language without support is nonsensical, but complaints about lacking them are pretty understandable I think.

comment 4y ago · link · parent

I don't really see how this relates to the article. The author specifically mentions that he also encountered these problems in Racket (a functional programming language). Anyway:

>I do not understand why so many of you are so vigorously adamant that you're going to program in the intersection of functional programming languages and imperative programming languages

Because it actually works pretty well? The vast majority of programming languages today are multi-paradigm for a reason. In fact, almost all functional programming languages (Lisp, Scheme, Racket, Clojure, (S)ML, OCaml, F#, Scala) are multi-paradigm. Haskell is really the odd one among functional programming languages. The same applies to lazyness by the way, to claim that functional programming is "critically based on pervasive laziness" is simply wrong.

The idea that people use FP in a language like e.g. JS only because of an ideology driven obsession and that they constantly have to fight against the language just doesn't bear out in reality.

comment 4y ago · link · parent

Yes? From the article:

>The day after his death, Kelly, 36, tweeted “the only good Brit soldier is a deed one, burn auld fella buuuuurn.”

Very crude, but he was celebrating his death, not calling for it.

comment 4y ago · link · parent

Copilot is great as a 'smart auto-complete' or when you need to do pattern based drudge work... but that's not what this article is about. It's trying to sell people on copilot as a no-code tool.

The leading question is this:

>But as helpful as it is for coders, what if it enabled non-engineers to program too – by merely talking to an AI about their goals?

and it answers this in my opinion deceptively by presenting what amounts to a parlor trick. Whether copilot in general is any good or not is in my mind totally separate to this.

comment 4y ago · link · parent

The most bizarre part is that he took issue which the Liskov substitution principle which is just the intuitive definition of what semantic subtyping means. This isn't some crazy clean code "functions should have less than 20 lines" dogma, subtyping without semantic subtyping is just nonsensical.

comment 4y ago · link · parent

Wolf fencing = Using the bisection method/binary search to find errors.

Essentially what people intuitively do.

comment 4y ago · link · parent

At least as far as I know, non-binary identities are still anchored to the male-female dimension (which correlates to sex), but in a, well, non-binary way (i.e. a mix or complete rejection). From quickly looking them up the fa’afafine seem to line up with that.

comment 4y ago · link · parent

It's not "baiting for a debate", your explanation of gender, while reasonable on its own, is simply not what I asked for. I specifically wondered about a concept of gender completely independent of sex, because I'm not sure how that'd work. At the very least I imagine it has to be something radically different from the usual mainstream conceptions of gender.

But seeing as you had to trot out the generic, condescending 'go educate yourself', I'll just assume you simply don't know.

comment 4y ago · link · parent

But that's a definition that hinges on sex, so it's not at all independent. If you were to remove the correlation to sex, 'subjective feeling of identity' is essentially just subculture, so hipster, goth and skater would also be 'genders'.

comment 4y ago · link · parent

What is a coherent (non-recursive) definition of gender that is completely independent from sex?

To me it seems like you're just left with 'subculture' at that point, but I think that's missing something very core to gender, namely sexuality.

1
789
21