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

A gentleman's gentleman!


Here's a great talk by John Hughes, one of the authors of QuickCheck, with real-life examples:

https://www.youtube.com/watch?v=zi0rHwfiX1Q


Thanks, that's gotta be one of the best talks I've ever watched. A passionate speaker, talking about fascinating, useful tech, giving specific real world examples of utility, AND showing how to actually apply it for interesting "dirty" situations.


I used a similar setup for a while: Obsidian for taking notes in markdown, and vscode for coding.

Eventually I moved to using vscode for both. My gigantic notes.md file is always open in tab 1, so I can go to it immediately with Ctrl + 1.

Finding notes in a single file is easier for me than finding them in a bazillion tiny files. And there's less friction whenever I need to make a note (no need to create and name a new file).


I went the opposite way, I started off as you (with nvim), then moved to other open-source PKMs like Trilium, then used Obsidian and it was love at first sight.

Keeping everything in a git repo makes it easy to sync across devices + backed up.


Also see "I Pencil" by Leonard Read (1958).


> we've had that idea since at least Hofstadter and his sentient ant nests.

A similar idea is present in Herbert Simon's 'The sciences of the artificial', where he describes a sentient city.


Sincere question: what's wrong with Python f-strings?


Three people in a row and not one of you guys checked out Swift strings before commenting, thus making exactly the mistake I complained about.

Look up Swift strings. Python has 4 types of string literals. Swift has 1. And they are BETTER and more powerful. Cleaner.


Swift has "normal strings", #"raw strings"#, and """ for multiline strings. For interpolation, it uses "The answer is \(1+2)", but in a raw string you need #"The answer is \#(1+2)"#.

So compared to Python, string interpolation is always "on" and doesn't need an f-prefix. Because it uses the string escaping syntax, it doesn't have to take over a regular character like {, which requires {{ escaping.


Is this supposed to be better than python? "Every string is an f-string, make sure you don't accidentally miss some interpolation." sounds like a step down, not like an improvement to me!


What do you mean by "miss some interpolation"?

There are two errors you could make in Python. Accidentally using {} in a normal string where you wanted interpolation, and accidentally using {} in an f-string where you wanted literal {}. I definitely do the former a lot.


The escape character is \. Same as in Python. But in Python you have to watch out for \ AND {. In Swift, only \.

And you can do this:

####"foo ###\(this is not interpolation) ####\(but this is) bar"####

In Pythons f-strings you can't ever write the literal `{foo}` in a string for documentation for example. It's a mess.


Close. But wrong.

Swift doesn't have raw strings and normal strings. Swift has ONE syntax:

{#n}"string {#n}\(interpolation)"{#*n}

Where n can be zero or more. So let's recap:

1. ONE rule for start/end/escape prefix: A number of # that has to match. 2. ONE rule for escape: \.

I do Python full time and I wouldn't consider switching to Swift, but the string situation is horrible compared to Swift.


Yes it does, because normal strings aren't just a special case of raw strings when the number of #s is 0. The presence of #s change the string syntax. Otherwise you could as well say Python has one syntax, with optional f and r prefixes.


No, you can't. Because r/f changes and/or adds escape sequences, AND you can't have double-raw strings for example. In Swift there's 0, 1, 2, 3, 4, etc number of #. It's not raw strings at all! There's no -1 number of #. So for example to do regexes in python you normally use r-strings, to avoid \ escaping in the regex. In Swift you could do the same the opposite way: not by removing \ escaping, but by changing it to \#. And if you want to regex match for \#, you can do ##. And if you want to match for \## you can use ###, etc.

There is always a clean escape where you can write the literal that you want to write. Unlike in Python where there is no escape (amusingly).


Ah, I see. That is better.


Yea, it's a super nice system. It's such a pity that most language designers don't look at other languages before implementing stuff.

I tried to warn the D guys not to make this exact mistake, but they didn't listen :/


Computer vision. C++ and Python.


That was Blaise Pascal.


Funny… I’d actually always heard it was Newton. I checked and looks like you’re def right here.

I actually expected to find that it was a fake quote. Lately, I keep finding that many of the good quotes are actually fake. It’s like they actually survive on the value of the quote and, if we’re honest, whether someone decades or centuries ago actually said it is only tangential.

But thx for the correction!


"Sparks of Artificial General Intelligence: Early experiments with GPT-4"

https://arxiv.org/abs/2303.12712


What an awesome story! Thanks for sharing.


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

Search: