Readit News logoReadit News
mostlylurks commented on You Need Subtyping   blog.polybdenum.com/2025/... · Posted by u/speckx
stephantul · 9 months ago
What is the meaning of the word “boxed” in this article? Bit confused about it.
mostlylurks · 9 months ago
Not represented directly in memory in its raw form right where the value is placed, but rather stored somewhere else (usually the heap) / in an opaque manner and accessed via an indirection, such as a pointer / reference. Often involved in making things polymorphic, because different types usually have different representations in memory even if they implement the same interface, so they need to be boxed.
mostlylurks commented on Definite clause grammars and symbolic differentiation   bitsandtheorems.com/defin... · Posted by u/Knaapje
ted_dunning · 9 months ago
Ah, yes. I remember this well.

DCGs are lovely things that allow you to implement a toy example quickly but then the dragon appears and gobbles you up..

The scent of dragon's breath can already be seen in this example in a couple of places.

In the first place, using DCGs generatively is very interesting. It implies that you can write programs that generate strings as easily as parse them.

But the question of which grammars are reversible this way is very thorny. Even worse, this question is highly context specific. A grammar might be reversible in one context and not in another. Reversibility is also very delicate. Adding trivial changes to a parser can suddenly make it no longer reversible.

The second scent is the way that apparently small limitations in the Prolog language start to have very large implications in terms of program complexity. Since these limitations are inherited by the DCG framework itself, it quickly becomes necessary to either lose the attractive identification of Prolog expressions with syntax trees or to wind up with an explosion in program size.

An example appears in this article. The differentiation for each of the functions exp, sin, cos and tan involves a separate definition of the chain rule. For instance, we have

    % Cosine derivative (+ chain rule)
    derivative(X, cos(E), -DE*sin(E)) :-
      derivative(X, E, DE).
The problem here is that we want to write something like this:

    % chain rule
    derivative(X, F(E), DE*DF(E)) :-
      derivative(u, F(u), DF(u)),
      derivative(X, E, DE).
and then simply define derivatives of each function without the chain rule.

We can't do that, however, because Prolog doesn't support unification of functors. We could patch that if we started referring to function application with more elaborate syntax by parsing "sin(exp(x))" as application(sin, application(exp, x)) so that we could unify on sin, but this quickly obscures the syntax tree and removes the delightfully direct nature of DCGs.

We see problems popping up in the simplification as well. The problem of simplification is that you can wind up simplifying in circles which makes a depth first approach as used in Prolog very dangerous. The authors insert a cut to avoid this, but this also suddenly makes the entire system non-reversible.

The fundamental problem is that logic programming in the form of Prolog is practical precisely because of these limits. If you want more expressive power, you need to start talking about much more than unification and depth first search. At that point, you suddenly wind up with mechanisms like coordinate types which have the full expressivity of formal logic, but lose the simple execution of Prolog; simple type checking becomes undecidable.

mostlylurks · 9 months ago
> We can't do that, however, because Prolog doesn't support unification of functors. We could patch that if we started referring to function application with more elaborate syntax by parsing "sin(exp(x))" as application(sin, application(exp, x)) so that we could unify on sin, but this quickly obscures the syntax tree and removes the delightfully direct nature of DCGs.

Would the =../2 predicate help? It allows for you to unify functors without wrapping them in something like your application(exp, x) example. Not sure how it would interact with DCGs, though - never took more than a superficial glance at them.

mostlylurks commented on Everything about Google Translate crashing React (and other web apps)   martijnhols.nl/blog/every... · Posted by u/MartijnHols
JimDabell · 10 months ago
I don’t see why Google Translate wrapping all text in <font> elements is reasonable. Why is an extra element required, and why is it <font> of all things? Translate is swapping text for text, so this shouldn’t be necessary. It also breaks a lot more than just JavaScript frameworks. Things like the child combinator in CSS selectors will break too.
mostlylurks · 10 months ago
> Why is an extra element required, and why is it <font> of all things?

I don't know, but perhaps due to the fact that due to the CJK unification in unicode, rendering Chinese or Japanese without explicitly setting a font designed for that particular language can output incorrect characters (of the other language, which are considered "the same character" despite being different). Thus, a translation tool would have to explicitly set a font in order to display these languages correctly in a reliable manner, because the surrounding context certainly cannot be assumed to have the appropriate font. And I could easily imagine that someone would choose to keep the same code path for all languages instead of branching for this particular case, resulting in a <font> even for languages other than those two.

mostlylurks commented on Why it's impossible to agree on what's allowed   danluu.com/impossible-agr... · Posted by u/_xivi
mostlylurks · 2 years ago
The presented trichotomy between no moderation, moderation, and federated moderation is false.

Moderation can also be accomplished via a user-level web-of-trust system, where each user can choose who to trust as a moderator, and this trust can propagate recursively to the people trusted by the people you trust, and at each level (even when manually choosing people to trust) this trust can be fuzzy (not full trust vs no trust, but potentially something in between those two), and rapidly decreasing the more distant you get from those you've manually chosen to trust. To solve the issues of spam, censorship, and convenience simultaneously, you simply assign to users some moderators on the trust list by default and allow users to opt out of that trust.

This approach is also applicable in the same manner to the similar problem of curation (i.e. choosing what to highlight instead of what to hide), where the same four approaches are also applicable with largely the same pros and cons.

mostlylurks commented on Is Open Source a diversion from what users want?   discourse.ardour.org/t/is... · Posted by u/bobajeff
bitwize · 2 years ago
But when it comes to computer use and knowledge, there is a divide between techies and just about everyone else. It's not just about lack of knowledge but also lack of fucks to give. Techies just love to build and configure things to their liking. The rest of us have things to do, and would just rather buy the functionality they need in a ready-to-go and easy-to-use form. This is why when computers meet creative work, except maybe for programming, the best-of-breed professional tools are all proprietary. Nobody in those lines of work gives a shit about source availability. They will endure dark patterns techies find intolerable, just to have that functionality. Hello Adobe subscription model. It's not hard to find a Hackernews who will say "I'd rather pay that $23/month for Photoshop than have to endure GIMP."

Speaking of, the above goes for technical professionals too: sooner or later, many of them will put their college kid tinkering hobbies aside and just buy a Mac, freeing up time they would have spent tinkering with a Linux distro to cook dinner for their spouse or play with their kids.

I used to be like you and believed it was senseless and harmful to believe there was a divide between users and programmers. I was smoking that "any user could become a programmer" copium in my 20s. But there is a divide and it's a wide, wide gulf. One of the things that got me to put the programmer hopium/copium pipe down was getting married. She's very smart, but she buys 100% Apple kit and doesn't have to worry about maintaining or configuring anything after initial purchase.

mostlylurks · 2 years ago
> Techies just love to build and configure things to their liking.

I don't, and I don't believe I'm even in the minority in that regard. What you are referencing is a stereotype that may reflect a minority of so called "techies", but even those are almost certainly only interested in building and configuring things within some specific field of interest, but still want everything outside of that to "just work".

> The rest of us have things to do, and would just rather buy the functionality they need in a ready-to-go and easy-to-use form.

A false dichotomy that is often repeated, but incorrect nevertheless, for it is the proprietary ecosystem that keeps breaking things over and over again, changing UIs, features, and even very basic settings you've set, dropping support for various things (apps, devices, etc.) you might still use and that still work fine.

My linux installations have made everything work directly out of the box (unlike some properietary systems where you have to install things and fiddle with settings to make things work) and have stayed almost identical in terms of their UI and already-existing features for a decade now (and could have for quite a bit longer if I had adopted linux earlier). No properietary system could come even close to this level of "just works"-ness (though apple probably gets far closer than the others).

mostlylurks commented on Is Open Source a diversion from what users want?   discourse.ardour.org/t/is... · Posted by u/bobajeff
jqpabc123 · 2 years ago
Open Source is a game developers play amongst themselves. When Open Source developers say "users", they often mean other developers.

The vast majority of real, ordinary *users* don't really care.

mostlylurks · 2 years ago
Developer-users are real users. A tool (such as a piece of software) is not just a toy just because it's targeted towards users that actually have the skillset to make proper use of it. In fact, quite the opposite; the most useful tools (in any domain, not just software) are often quite inaccessible to those without the prerequisite expertise. Commercial products may be heavily incentivized to make themselves appeal to even the most inexperienced users, and obtain a much wider userbase as a result, but how many of those users actually do something useful with that, and is the proportion of such users high enough that it would make sense for FOSS developers to target them, instead of their existing more reliably competent userbase?
mostlylurks commented on VueJS turns 10 years old   twitter.com/vuejs/status/... · Posted by u/YourCupOTea
troupo · 2 years ago
You need custom tools for React, too. Because JSX is not valid JS.

In most (all?) IDEs you can also tell the IDE to treat the file with a certain extension as written in any language

mostlylurks · 2 years ago
You don't, because JSX is not required for react. This isn't even just a theoretical point, but something I've actually done in the past several times; it's very convenient to just try something out by throwing react into a script tag and then just writing a small prototype or something without utilizing JSX and thus avoiding the need to set up a build system and everything else. I would still use JSX for larger projects, of course, but it is mostly just a small quality-of-life improvement, and I'd be using react even if JSX didn't exist, as the actually important parts of the library are not about JSX.
mostlylurks commented on My favourite Git commit (2019)   dhwthompson.com/2019/my-f... · Posted by u/karagenit
brabel · 2 years ago
> Even if you're _very good_ at Git, finding the correct invocation of "git blame" (is it "-w -C -C -C"? Or just _two_ dash C's?) to even find the right messages

I am terrible at git on the terminal, but with IntelliJ or emacs and magit, I can trivially find every commit ever to change a file, and easily navigate the commits to see every full commit message. It's not hard when you use a proper tool, and I have a feeling almost everyone has something like that?! Do you really try to stick with the git CLI and memorize hundreds of commands and flags?? Why?!

mostlylurks · 2 years ago
I don't find it more difficult to use or remember commands for than remembering how to accomplish similar tasks in some GUI (especially if that GUI is emacs). And unlike most GUIs (emacs may be an exception), I can trust that my knowledge of the git CLI won't become out of date when my GUI tool inevitably undergoes a UI redesign of some sort.

But more importantly, the CLI allows my typical workflow where I chain together a bunch of git (and other) commands in a row, allowing me to just type in, for instance, several different commits, their messages, and what files should go into each in one go without having to break my concentration by having to move around in some GUI between commits. Sprinkle in some stash manipulation and interactive rebases, compilation, and unit testing, and you'll really start to see how the CLI allows you to offload some of your working memory to your invocation in a way that a GUI just can't.

mostlylurks commented on My favourite Git commit (2019)   dhwthompson.com/2019/my-f... · Posted by u/karagenit
Cthulhu_ · 2 years ago
This is the problem with any kind of documentation; while you can write the highest quality, meticulous, most obvious and clearest prose, it's moot if nobody reads it.

And nobody reads it because there's so much of it and there's no clear starting point. People just want the summary of what they're looking for.

I started to learn Java almost 20 years ago, we had a text book and everything. After the first two chapters, I learned how to google and instead of reading everything, just find what I need. I never went in-depth with reading because... it's mostly useless knowledge that quickly becomes outdated.

mostlylurks · 2 years ago
With commit messages, there is a very clear starting point: the commit message for the commit that last touched the line of code you're looking at with git blame, which is my standard solution for finding out the reasoning behind any piece of code I don't quite understand. Only works for projects that don't destroy their history with squashes or otherwise write uninsightful commit messages (e.g. "fix bug").
mostlylurks commented on The web just gets better with Interop 2024   webkit.org/blog/14955/the... · Posted by u/feross
Spivak · 2 years ago
That ship has long since sailed. The web is the preferred framework for creating "non-native" (maybe nomadic? colonizer? invasive?) apps that largely ignore their host platform in favor of being the same everywhere. For better and worse this is what developers and designers have always wanted out of portability.
mostlylurks · 2 years ago
It's also what I, as a user, want. I don't want some middle-man corporate "platform" (of which there are very few to actually select from to suit your personal tastes) inserting their vision of what UIs should look like into interactions between me and the service I'm connecting to. I want my platform to be as invisible as possible and interchangeable with other platforms. The more things stay the same when switching between platforms, the better.

u/mostlylurks

KarmaCake day483February 6, 2018View Original