Live data from Hacker News

What was the last breakthrough in computer programming? (2019)

quora.com

111–120 of 226 posts

Re: What was the last breakthrough in computer programming? (2019)

#111
post #25

Earlier quoted context omitted.

It's nice to read a positive comment like yours occasionally, because the vast majority of the time, I'm just disappointed in how bad our programming tools (including languages) are. It's become a meme in my office that I'm the guy constantly bitching about how stupid our languages are. This week I was back on my soap box about the fact that almost zero mainstream (statically typed) programming languages can even let…

> How many times did you write "int" when you actually only wanted a positive number? subtracting one from zero and getting max_uint can be its own brand of fucking horribly awful. having the language itself throw in that circumstance can also be exactly what you don't want.

In some languages you can get a choice. Broken record time, but Ada:

  type Byte is unsigned 2**3;
This will permit any value in the range [0,7] and when you exceed it (in either direction) it will wrap around (the desired action if you choose this type). In contrast:

  type Byte is range 0..7;
Will give you a runtime error when you exceed the bounds by trying to increase beyond 7 or decrease below 0. Having this choice is nice, you get to decide the semantics for your system.

Re: What was the last breakthrough in computer programming? (2019)

#112
post #108
post #67

Earlier quoted context omitted.

I'm not so sure that I sympathize with your example. Why not a type for even numbers? Odd, prime, not-prime, etc? You really are asking for a type that is "valid data." Commendable, but not a static property of data. As a fun example, what is a valid email address? Once established as valid, how long will it stay that way? If invalid, how long until it can become valid? Do I think better typing can be a boon? Absolut…

That’s easy, a valid email address is one that is well formed, conforming to the specification for email addresses. I know what you’re trying to get at, but that’s just a category error. It’s a misuse of the term valid in this context. For example my mail archive contains many emails from valid addresses for which there happens to be no currently active mail box end point. They’re still valid data though. The fact th…

> conforming to the specification for email addresses

You mean something that roughly matches this obvious regex:

  \A(?:[a-z0-9!#$%&'*+/=?^_‘{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_‘{|}~-]+)*
   |  "(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]
        |  \\[\x01-\x09\x0b\x0c\x0e-\x7f])*")
  @ (?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
    |  \[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}
         (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:
            (?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]
            |  \\[\x01-\x09\x0b\x0c\x0e-\x7f])+)
       \])\z
[ Source: https://www.regular-expressions.info/email.html ]

That somehow doesn't look "easy" on my eyes. I'm not sure the parent's comment was serous.

Re: What was the last breakthrough in computer programming? (2019)

#113

Earlier quoted context omitted.

> How many times did you write "int" when you actually only wanted a positive number? subtracting one from zero and getting max_uint can be its own brand of fucking horribly awful. having the language itself throw in that circumstance can also be exactly what you don't want.

In some languages you can get a choice. Broken record time, but Ada: type Byte is unsigned 2**3; This will permit any value in the range [0,7] and when you exceed it (in either direction) it will wrap around (the desired action if you choose this type). In contrast: type Byte is range 0..7; Will give you a runtime error when you exceed the bounds by trying to increase beyond 7 or decrease below 0. Having this choice…

Are that static or runtime checks (or both)?

Re: What was the last breakthrough in computer programming? (2019)

#114

Earlier quoted context omitted.

> How many times did you write "int" when you actually only wanted a positive number? subtracting one from zero and getting max_uint can be its own brand of fucking horribly awful. having the language itself throw in that circumstance can also be exactly what you don't want.

In some languages you can get a choice. Broken record time, but Ada: type Byte is unsigned 2**3; This will permit any value in the range [0,7] and when you exceed it (in either direction) it will wrap around (the desired action if you choose this type). In contrast: type Byte is range 0..7; Will give you a runtime error when you exceed the bounds by trying to increase beyond 7 or decrease below 0. Having this choice…

Yeah I took Ada for CS 210/211 back in 1991, are we there yet?

Re: What was the last breakthrough in computer programming? (2019)

#115
post #59

Earlier quoted context omitted.

>how often have you ever written a function that requested a string as input and actually wanted an empty string? To be fair, I do it quite often. Most of the strings I deal with in my code are coming from user input, and most of them are optional. They are usually just passed to/from a database. If the string has some internal meaning (like ULSs or file paths), it usually gets wrapped in an object anyway. If you're…

Let me ask you this, though. If your strings that come from user inputs are optional, doesn't that mean they could also just not be present (as in null)? Why do you need or want two different ways to express "nothing"? Are all of the text fields just funneled right into the database without checking/validating any of them? I've written a number of RESTy/CRUDy APIs and I can't count the number of "check that username…

> I've written a number of RESTy/CRUDy APIs and I can't count the number of "check that username isn't empty" checks I've written over the years.

But you do it only once, thereafter you have hopefully some "Username" type of object which is guarantied to contain a valid username.

Re: What was the last breakthrough in computer programming? (2019)

#116
Maybe calling these "breakthroughs" is a stretch, but anyway...

Swift. I think that this is the best general purpose language ever created. By "best" I mean that it has the highest productivity (which is determined by readability, static safety, expressiveness, etc.) after normalizing for factors outside of the language spec, e.g. tooling, libraries, compilation and runtime speed.

React and Svelte. The first breakthrough was React, the second generation is Svelte and similar frameworks.

Async / await. This is a major improvement to the readibility and mental model simplicity of the most common type of concurrency code.

Re: What was the last breakthrough in computer programming? (2019)

#117

Earlier quoted context omitted.

In some languages you can get a choice. Broken record time, but Ada: type Byte is unsigned 2**3; This will permit any value in the range [0,7] and when you exceed it (in either direction) it will wrap around (the desired action if you choose this type). In contrast: type Byte is range 0..7; Will give you a runtime error when you exceed the bounds by trying to increase beyond 7 or decrease below 0. Having this choice…

Are that static or runtime checks (or both)?

Definitely runtime, potential for compile time. The compile time checks will at least prevent obvious cases (assigning a value out of the range like using either Byte type above: T := -1 will get a compile time error). Using the second Byte type, paired with SPARK/Ada, this bit of code should set off the proof system and prevent compilation:

  procedure Foo is
    type Byte is range 0..7;
    T : Byte := 0;
  begin
    T := Byte - 1;
  end Foo;
(Not that that's useful code, but a basic example.) That shouldn't make it past the SPARK/Ada system to compilation. Now change it to this:

  function Foo(T : Byte) return Byte is
  begin
    return T + 1;
  end Foo;
and SPARK/Ada should warn (been a bit, but should also fail to compile) that this could cause overflow.

Re: What was the last breakthrough in computer programming? (2019)

#118

Earlier quoted context omitted.

In some languages you can get a choice. Broken record time, but Ada: type Byte is unsigned 2**3; This will permit any value in the range [0,7] and when you exceed it (in either direction) it will wrap around (the desired action if you choose this type). In contrast: type Byte is range 0..7; Will give you a runtime error when you exceed the bounds by trying to increase beyond 7 or decrease below 0. Having this choice…

Yeah I took Ada for CS 210/211 back in 1991, are we there yet?

Ada's good, but it will never win. The open source compilers are solid, but no one wants to learn it. It's (depending on who you ask): Too old, too verbose, BDSM programming, not Rust, not Haskell, not C.

It has a lot of positive features going for it, but it is verbose. That verbosity is a major distraction for people who can't handle it, they want their very short keywords or, better, no keywords just symbols. Curly braces are somehow better than begin/end even though begin/end really aren't hard to type. Ada shines, particularly, in the long tail of system maintenance, not in the writing (arguable: the type system certainly helps a lot in the writing, the syntax doesn't). So I press for it where it belongs, and don't where it doesn't. But when someone laments the state of type systems, I point it out.

Re: What was the last breakthrough in computer programming? (2019)

#119
post #25

There isn't so much in languages features themselves, but in their implementations. GC can be largely pauseless for many practical purposes and a GC language can be within 2x-3x the performance of C-like languages. Also the amount/cost of memory has improved so that we can use immutable datastructures and functional style in many contexts, which definitely feels like a 'level-up'. Concurrency has been getting easier…

It's nice to read a positive comment like yours occasionally, because the vast majority of the time, I'm just disappointed in how bad our programming tools (including languages) are. It's become a meme in my office that I'm the guy constantly bitching about how stupid our languages are. This week I was back on my soap box about the fact that almost zero mainstream (statically typed) programming languages can even let…

[deleted]

Re: What was the last breakthrough in computer programming? (2019)

#120
post #25

There isn't so much in languages features themselves, but in their implementations. GC can be largely pauseless for many practical purposes and a GC language can be within 2x-3x the performance of C-like languages. Also the amount/cost of memory has improved so that we can use immutable datastructures and functional style in many contexts, which definitely feels like a 'level-up'. Concurrency has been getting easier…

It's nice to read a positive comment like yours occasionally, because the vast majority of the time, I'm just disappointed in how bad our programming tools (including languages) are. It's become a meme in my office that I'm the guy constantly bitching about how stupid our languages are. This week I was back on my soap box about the fact that almost zero mainstream (statically typed) programming languages can even let…

Common Lisp can do that

  CL-USER> (defun non-empty-string-p (string)
             (and (stringp string)
                  (plusp (length string))))
  NON-EMPTY-STRING-P

  CL-USER> (deftype non-empty-string ()
             `(satisfies non-empty-string-p))
  NON-EMPTY-STRING

  CL-USER> (typep "" 'non-empty-string)
  NIL

  CL-USER> (typep " " 'non-empty-string)
  T
Post reply on HN