[-] barubary@infosec.exchange 3 points 2 weeks ago

Look up history-search-backward in your favorite bash/readline manual.

[-] barubary@infosec.exchange 2 points 3 weeks ago

This is an entirely new way to misuse "strongly typed" that I was not aware of before. Amazing.

Thank you!

[-] barubary@infosec.exchange 2 points 4 weeks ago

I disagree with pretty much everything you write here, but especially this:

First of all, you have exact same amount of parens as you would in a mainstream language like Java, C, or Js.

My Perl example uses "mainstream language" syntax. Apparently that doesn't count because it's Perl (scary! mental overhead! write only!), so here's exactly the same thing in JavaScript:

function hypot(x, y) {    return Math.sqrt(x ** 2 + y ** 2);}

... or

const hypot = function (x, y) {    return Math.sqrt(x ** 2 + y ** 2);};

... or

const hypot = (x, y) => Math.sqrt(x ** 2 + y ** 2);

Note how none of these involve four layers of nested parentheses.

[-] barubary@infosec.exchange 4 points 1 month ago

Does Ruby require the use of [] and {} there? Because those %w/%i/etc things look like custom quoting operators and at least in Perl you can use any delimiter you want: qw(a b c) is a list of strings, but so are qw+a b c+ and qw;a b c;.

[-] barubary@infosec.exchange 3 points 2 months ago

CPU? It's called a modem!!

[-] barubary@infosec.exchange 4 points 2 months ago

BTW, you can configure uBlock Origin to block all 3rd party javascript by default, but allow 1st party scripts, so you don't even need NoScript to get most of these benefits.

[-] barubary@infosec.exchange 4 points 2 months ago

If you were pair programming, your pair could always create a new failing test with the current implementation.

But I'm not pair programming. And you can't always create a new failing test because int is a finite type. There are only about 4 billion cases to handle.

Which might take a while to type up manually, but that's why we have meta-programming: Code that generates code. (In C++ you could even use templates, but you might run into compiler recursion limits.)

More to the point, the risk with TDD is that all development is driven by failing test cases, so a naive approach will end up "overfitting", producing exactly the code required to make a particular set of tests pass and nothing more. "It can't pass all test cases"? It doesn't have to. For TDD, it only needs to pass the tests that have actually been written. You can't test all combinations of all inputs.

(Also, if you changed this function to use modulus, it would handle more cases than before, which is a change in behavior. You're not supposed to do that when refactoring; refactoring should preserve semantics.)

[-] barubary@infosec.exchange 4 points 2 months ago

When you say "it can't pass all test cases", what do you imagine the tests look like?

[-] barubary@infosec.exchange 4 points 4 months ago

I am 100% confident that your claim is factually wrong.

[-] barubary@infosec.exchange 5 points 4 months ago

I agree with your core point, but no software is intuitive.

[-] barubary@infosec.exchange 3 points 6 months ago

Yeah, just don't make any mistakes and you'll be fine. Come on guys, how hard can it be?

[-] barubary@infosec.exchange 4 points 9 months ago

@masterspace "Undeclared variable" is a runtime error.

Perl.

view more: ‹ prev next ›

barubary

joined 2 years ago