Better HN
topnewbestaskshowjobs
Log inSign up

codesections

2,587 karma · joined Jul 5, 2018 (8y ago) · 324 submissions

Free software developer working primarily in Raku and Rust. Former attorney at Davis Polk & Wardwell LLP; current member of the Raku Steering Council and The Perl & Raku Foundation board. My professional interests include web development, open source, and making things as simple as possible.

  website:     www.codesections.com
  public key:  codesections.com/pubkey.txt
  email:       daniel@codesections.com
  mastodon:    fosstodon.org/@codesections
  github:      github.com/codesections
  discord:     discord.com/users/555470786677440524
I am also the 'codesections' user on: gitlab, github, stack overflow, libera.chat, reddit, tildes, lobste.rs, and probably other sites
Submissions

comment 4y ago · link · parent

And originally from 2009 (as noted in the previous HN links)

comment 4y ago · link · parent

Does this site accept suggestions for new questions? I'd like to see a question on which end to open a banana

33.

Atmospheric CO2 causes lower protein, higher sugar content in modern crops(politico.com ↗)

4 points · by codesections · 4y ago · discuss

34.

The Stakhanovite Movement(en.wikipedia.org ↗)

3 points · by codesections · 4y ago · discuss

35.

Coding error at Santander Bank put millions into random accounts on Christmas(cnbc.com ↗)

155 points · by codesections · 4y ago · 79 comments

comment 4y ago · link · parent

> When debugging code or studying a program, it is quite comfortable to depend on only one hand, and have the other free to scribble or relax.

I wonder if the OP is ambidextrous? If using the mouse gave me a hand free to scribble some notes, I'd be a much more enthusiastic mouse user. Alas, both writing and mousing require my right hand, and there aren't many good uses for my left.

comment 4y ago · link · parent

Thanks for the update, and you're absolutely right that Beeminder doesn't offer any way to validate the data you enter. They discuss why (in their view, of course) trusting user-entered data works in this blog post: https://blog.beeminder.com/cheating/

comment 4y ago · link · parent

Beeminder[0] is a similar app — one that I've been a happy user of for 5+ years[1].

(Beeminder was also mentioned in a subthread reply by darrenf[2])

[0]: https://www.beeminder.com

[1]: https://www.beeminder.com/codesections/gallery

[2]: That reply read:

> Beeminder[0] is another. I particularly like that they keep a list of competitors in this space[1] - active, up and coming, dormant or dead. OP, perhaps you could think about asking Beeminder to add you to their list :)

> [0] https://www.beeminder.com/overview

> [1] https://blog.beeminder.com/competitors/

comment 4y ago · link · parent

> (Beeminder is primarily based on API integrations)

This strikes me as a significant mischaracterization of Beeminder. I've used Beeminder for 5+ years[0] and I've never used an API integration — Beeminder supports manually entering data for any goal. (And basically none of my goals have been digital; I'm not sure where you got the impression that Beeminder exclusively targets digital goals).

[0]: https://www.beeminder.com/codesections/gallery

comment 4y ago · link · parent

This story was also entertainingly told on Episode 73 of the wonderful Half Arsed History podcast, https://halfarsedhistory.net/2019/11/17/episode-73-uss-willi...

comment 4y ago · link · parent

Thanks for sharing these ideas. Raku is actually in the process of migrating to a new package ecosystem, so this could be an ideal time to get something like this set up. I'm not sure how much work would be involved from a technical standpoint, but I've opened an issue[0] to ask the maintainer of our ecosystem package repository; hopefully we'll be able to implement a system somewhat along these lines.

[0]: https://github.com/tony-o/raku-fez/issues/50

comment 4y ago · link · parent

> Trusting any single author is a single point of failure — eventually the author of one of the packages you depend on will get compromised and an attacker will publish a malicious package.

Thanks, this is exactly the sort of thing I had in mind when writing the "Making _ trustworthy"[0] section and exactly the sort of conversation I was hoping my post would prompt. One benefit I'm hoping to get from keeping the `_` sub-packages as simple/self-contained as possible is that that sort of supply-chain attack will be easier to spot (e.g., with a 0-dependency file, you couldn't use an attack like the event-stream incident, where a dependency was swapped out for a malicious copy – the malicious code would have to be in the repo itself).

Of course "easier to spot" ≠ "won't happen", which is where your other point comes in:

> To combat this, you need package validation by multiple independent identities. The classic ways to do this are to have multiple people sign a package using PGP

Someone else made a similar point in an r/programminglanguages comment[1] in response to part 1:

> One thing I'd like to see package managers adapt, though, is quorums for publishing. A simple majority quorum of amongst 3+ people would naturally make hacking much more difficult

Do you happen to know any details about how something like that could be put into practice? I agree that it seems like something that'd be worth investing in, as an ecosystem and would be interested in any info/thoughts other care to share.

[0]: https://raku-advent.blog/2021/12/11/unix_philosophy_without_...

[1]: https://www.reddit.com/r/ProgrammingLanguages/comments/raau0...

comment 4y ago · link · parent

> I never seen people locking the dependencies to an exact version

This depends heavily on the language/ecosystem. For example, golang's Minimal Version Selection[0] basically requires libraries to specify an exact version – the only way they'd get a higher one is if another library in the dependency graph had manually upgraded to the higher version.

But yeah, if the source is hosted externally and you don't have a local copy somewhere, then that's going to hurt. Which is (part of) why "should I vendor my dependencies" is such a perennial topic.

[0]: https://research.swtch.com/vgo-mvs

comment 4y ago · link · parent

Thanks.

I took a (somewhat quick) look and I'm pretty sure that Raku has equivalents for all of the Enumerable methods except for partition. (We could do basically the same thing with our classify[0] method by converting the Hash to an Array. Or do it manually with a reduce. But there are times when a partition method would be handy.

[0]: https://docs.raku.org/type/List#routine_classify

The String methods might be offer a few more options, but I'll need to think more carefully about that. It's idiomatic (and supported with syntax) to use Regexes for at least some of those tasks in Raku. Plus, Raku's strings aren't directly iterable/indexable (though it's trivial to convert them to a list of characters), and Raku doesn't have a direct equivalent to a symbol (something that I do miss). I suspect that, even with those factors, there might be some ideas worth stealing in there, so thanks for the pointer.

(Oh, and I know that it's "just" syntax, but for some reason I *really* like the idea of having an sprintf operator. I hadn't thought of a language doing that, but I just might borrow that one!)

comment 4y ago · link · parent

I just saw the code you added; here's a pretty literal translation into Raku in case you're curious (I'm assuming that `<blog posts objects>` is a stand in for omitted code)

    my @arr = [blog_post_objects];
    
    # Author may be Nil
    my $author-count = +arr.map(*<author>).grep(*.defined).unique;
(Though note that this would only exclude undefined authors. In most situations, I'd probably either know that all defined authors are truthy (e.g., an object) or would want to exclude the falsy ones as well (e.g., empty string). in that case I'd use `.grep(?*)` save a few characters.)

comment 4y ago · link · parent

Thanks, those all seem useful.

Assuming I'm following you correctly, Raku already has equivalents to each of those built in: we have code blocks[0], List.map[1] (or `for list -> $el { [codeblock]}`[2] which is a `for` loop, but not a C-style one), and the Iterable/Iterator Roles[3].

So I don't think those features give me any ideas for items to add to the library – but I agree that I'd be sad in a language without them!

[0]: https://docs.raku.org/language/control#index-entry-control_f...

[1]: https://docs.raku.org/routine/map

[2]: https://docs.raku.org/syntax/for

[3]: https://docs.raku.org/language/iterating

comment 4y ago · link · parent

> (3) ["write programs to handle text streams"] definitely makes no sense outside of CLI commands

I'm not sure I'd say that. In the web development world, you'll definitely see people arguing to "JSON all the things" (text) but others arguing to "protobuff all the things" (binary). And they raise many of the same simplicity-vs-performance issues that came up for Unix CLI commands.

As for (1) and (2) being too ill-defined/a matter of taste – well, I agree, but I don't think that means they're useless. I think of them as being in the same category as advice for writing prose ("Use short sentences where possible", "Avoid cliches"): helpful goals to keep in mind, even if I can't pin down exactly what they mean.

comment 4y ago · link · parent

Separating the question of "functional units" from "packaging units" is a good point – you're right that there's nothing non-Unix-y about packaging coreutils together.

I might add a third category, though, maybe "development units"? Something like Python's batteries-included standard library strikes me as a bit less Unix-y – not because it packages things together but because they (as I understand it) develop things together and do so in a way that creates barriers to outside packages integrating quite as well as standard library packages. (Or at least that's what I've understood from the outside, looking in)

comment 4y ago · link · parent

> Maybe published package versions should be immutable.

They are in many languages. Of those I'm familiar with, Raku, Rust, and JavaScript all have immutable package repos. (npm wasn't when left-pad was pulled but has changed since then).

Of course, in each case they're only "immutable" in the sense that some organization (with varying degrees of centralization) has promised to host them forever; people clearly vary in their willingness to believe promises of that nature.

comment 4y ago · link · parent

> Ruby has truly ruined me for stuff like this. Most basic functionality and some non-trivial functionality is covered in the standard library.

Ruby is one language I haven't had the chance to explore yet. Are there any Ruby functions you particularly miss in other languages? Any that aren't built in to Raku might be ones I consider for the `_` utility library.

comment 4y ago · link · parent

> I'll rather use a really small, static (as in never changing) package [instead of one] that get updates every day and breaking changes from time to time.

That's an entirely fair point and, as I got into a bit in the versioning[0] section, something that I'm giving a good deal of thought too.

I'm currently leaning towards tracking the Rakudo[1] compiler releases (~monthly), so updates wouldn't be anything like daily. As far *breaking* changes go – well, again, I'm still thinking about/discussing what guarantees to make, but I'm hoping to be able to promise to (try to) provide strong backwards compatibility. One thing I mentioned in the post is that Raku's strong support for multiple dispatch[2] makes backwards compatibility a bit easier: `_` can add a new version of a function without impacting the existing one.

That still leaves _accidental_ breakage (i.e., bugs) – which is the area I'm currently most concerned about. If not handled correctly, a utility package risks creating its own sort of internal dependency hell: if there's a bug in one sub-package that you use, it could potentially block you from using that version – even if a different sub-package has a feature you want. I'm not sure of the best solution yet, but I'm exploring a few Raku options that I think may let me provide versions at the sub-package level (or maybe even the function level?). That's very much a WIP for now, but it's something that'll happen before a 1.0.0 release.

[0]: https://raku-advent.blog/2021/12/11/unix_philosophy_without_...

[1]: https://rakudo.org/

comment 4y ago · link · parent

This is the followup to Following the Unix philosophy without getting left-pad, https://raku-advent.blog/2021/12/06/unix_philosophy_without_...

53.

Following the Unix philosophy without getting left-pad(raku-advent.blog ↗)

5 points · by codesections · 4y ago · discuss

comment 4y ago · link · parent

> It starts up in seconds so you can begin working immediately

They and I have a very different idea of what the word "immediately" means

comment 4y ago · link · parent

> What’s wrong with 3?

You may have missed the "[that] they leave on the bottom" part of 3. It sounds like you don't leave your terminal open/visible unless you press ^v

comment 5y ago · link · parent

Though note that Cunningham disavows the law attributed to him:

> Cunningham himself denies ownership of the law, calling it a "misquote that disproves itself by propagating through the internet."

https://en.m.wikipedia.org/wiki/Ward_Cunningham

57.

OpenIndiana(en.wikipedia.org ↗)

3 points · by codesections · 5y ago · 1 comment

comment 5y ago · link · parent

> Published online 2007 Jan 11.

comment 5y ago · link · parent

> This honeycomb is sent to an illegal smelter, where the precious metals are extracted, distilled, and sold to manufacturers.

Does anyone know any details about this part of the operation? The article doesn't provide any, and I'm surprised to learn that "illegal smelters" are a thing — I've never thought of smelting as especially subtle

60.

VCS friendly, patchable, document line wrapping (2016)(dustycloud.org ↗)

2 points · by codesections · 5y ago · discuss

12345
11