Live data from Hacker News

Traps to Developers

qouteall.fun

71–80 of 113 posts

Re: Traps to Developers

#73
post #50

Earlier quoted context omitted.

Maybe this is cute monady stuff, but there isn't an equivalent to Optional > with only null/None. You usually don't directly write that, but you might incidentally instantiate that type when composing generic code, or a container/function won't allow nulls.

In what context would you not want to treat Optional.of(null) and null as the same? It shouldn't be a big deal.

Often people use optional or nullable types as a convenient approximation to an Either type.

Re: Traps to Developers

#75
post #73

Earlier quoted context omitted.

In what context would you not want to treat Optional.of(null) and null as the same? It shouldn't be a big deal.

Often people use optional or nullable types as a convenient approximation to an Either type.

I still don't see why it would be a problem merging then down even when used like an either. If there is no value then there is no value.

Re: Traps to Developers

#76
post #38

> Unset variables. If DIR is unset, rm -rf $DIR/ becomes rm -rf /. Using set -u can make bash error when encountering unset variable. sweet mercy :O Someone call the Inquisition

This was a very famous Steam bug

Re: Traps to Developers

#77
post #74

LF vs CRLF

Which is incredibly painful on Windows systems doing a git clone of shell scripts, since core.autocrlf is often helpful, but not for shell scripts, since it causes the weirdest looking error messages:

  MSYS$ cat build.sh
  #!/bin/bash
  echo "hello, world"
  MSYS$ ./build.sh
  : not found: 2: build.sh
e.g. https://askubuntu.com/questions/370124/not-found-error-when-...

Polite projects will have .gitattributes specifying that .sh or .bash or bin/* or whatever are to always checkout with eol=lf https://git-scm.com/docs/gitattributes#_eol>

As best I can tell, .ps1 does tolerate Unix lf but I'd bet good money that .bat and .cmd definitely do not

Re: Traps to Developers

#78

> Some routers and firewall silently kill idle TCP connections without telling application. Some code (like HTTP client libraries, database clients) keep a pool of TCP connections for reuse, which can be silently invalidated. To solve it you can configure system TCP keepalive. For HTTP you can use Connection: keep-alive Keep-Alive: timeout=30, max=1000 header. Once a TCP connection has been established there is no st…

Thanks I will correct that

Re: Traps to Developers

#79
post #25

> Java, C# and JS use UTF-16-like encoding for in-memory string That’s incorrect for Java, possibly also for C# and JS. In any language where strings are opaque enough types [1], the in-memory representation is an implementation detail. Java has been such a language since release 9 ( https://openjdk.org/jeps/254 ) [1] The ‘enough’ is because some languages have fully opaque types, but specify efficiency of some opera…

Thanks I will correct that

Re: Traps to Developers

#80
post #8

The first "trap" on the page says "min-width: auto makes min width determined by content", but this is false outside of flex/grid. From MDN: "For block boxes, inline boxes, inline blocks, and all table layout boxes auto resolves to 0." https://developer.mozilla.org/en-US/docs/Web/CSS/min-width

Thanks I will correct that
Post reply on HN