News for hackers. Stuff that matters.
Re:Weird Languages by skytreader on Saturday August 28, 2021 @10:34AM (#28338398)
> What can you say in this language that would be impossibly inconvenient to say in others?

Maybe it's just me and my possibly-unreasonable infatuation with the Sapir-Whorf hypothesis (SWH) but I've come to think it also applies to many things in life, PLs especially so. "Weird languages" aren't valuable because you can deploy it in production, rather because it will help you recontextualize a problem (in SWH-parlance, it helps you see the world differently).

You can also say, SWH is an academic formulation of the beloved programmer motto "When all you have is a hammer, everything looks like a nail". If all you know is an imperative syntax, all problems look solvable by breaking them down into a series of steps/procedures.

In my almost ten years in the industry, there's exactly one time I was able to apply an "unusual" paradigm to solve a problem. GvR might curse me because I sort of made a Lisp-like DSL in Python but I stand by my design decision. The end-result was a small (~200LoC linted with black) DSL parser with some DB access and a lot of rules which actually tried to solve the problem. When I found something wrong I just had to reformulate a rule, not actually wrangle with loops, conditionals, and control flow in order to rewrite logic.

Honest negatives: I had to turn over the project to someone whose background is in EEE, not CS, and I had to explain Higher-Order Functions to them. Not ideal! Actually, in fairness, I bet most in that team would have a hard time figuring it out because, hey, I made a Lisp in Python! But I still stand by my decision; it was the best for the problem given the resources and time I had.

Re:Weird Languages by dkarl on Saturday August 28, 2021 @12:37PM (#28339365)
Immutable record types as the default, most-used way of modeling data is a great idea that some languages cater to and other languages force you to do in weird, hacky ways.

Countless systems have been designed around mutable data simply because they were written in languages where mutable data was the default. I personally worked on several Java systems where mutability was used but was trivial to refactor out, because every place an instance was modified, it was simple to construct a new instance instead. On a couple of them I had ownership of the codebase and was able to complete this refactoring with a reasonable amount of effort.

I also created a small codebase in Java with an immutable data model, only to pass it off to someone who immediately added setters for every field because they were "missing." And then of course he started to find uses for them.

I don't have a desire to work in Java again, but I think Java recognizing immutable record classes as a concept worthwhile of first class language support is a significant step forward for the industry.

Re:Weird Languages by jl6 on Saturday August 28, 2021 @04:20PM (#28341181)
> Actually, in fairness, I bet most in that team would have a hard time figuring it out because, hey, I made a Lisp in Python! But I still stand by my decision; it was the best for the problem given the resources and time I had.

Are you completely sure you didn’t just create a massive headache for the team that followed you? Now they have to understand something that looks like magic, or pay more money to hire a wizard.

I’ve seen a lot of “clever and elegant” solutions that become instant legacy when the original genius leaves, and a lot of “boring and repetitive” solutions that stand the rest of time.

Re:Weird Languages by skytreader on Saturday August 28, 2021 @04:58PM (#28341420)
I feel like the bit you quoted already captures what I think came of it after I turned it over. It is even from a paragraph labeled "Honest negatives".

Complete certainty of how it turned out is a bit too much to ask. For every story like mine, there's an equivalent story of a legacy system in boring Java/C that no one wants to touch, works like magic, etc.

FWIW, I wrote a pretty extensive documentation of the project before I left, including recommendations for improvement[1]. Again, it's foolish to claim complete certainty but the nature of the project was such that they are unlikely to need to rewrite anything on top of the engine. Any modifications and additions moving forward would be in the declared rules, not in any of the logic. And for that, they have hundreds of examples from me to copy from.

And if they do need to touch the "parser", at ~200LoC the complexity is certainly far below, say, a Spring J2EE code base. It's all in one file too, that shouldn't be too bad.

[1] If I may use HN as a small soapbox, actually, months later, I figured out a further small addition to that project that would've made working with it far easier. If any of my previous team recognizes this and this project is still in use, feel free to reach out to me for one last brilliant idea. :)

Re:Weird Languages by xpe on Saturday August 28, 2021 @05:58PM (#28341863)
Sounds like a useful project.

> It's all in one file too, that shouldn't be too bad.

Fewer files is not necessarily better.

The guiding principle in my mind is reduction of entropy. If splitting one file into multiple files makes sense in the brains of the beholders it is a good thing.

Re:Weird Languages by robertlagrant on Sunday August 29, 2021 @04:06AM (#28345019)
200 lines in one file sounds fine on the face of it. I like it when I don't have to trace through to other files to see what's going on.
Re:Weird Languages by erik_seaberg on Saturday August 28, 2021 @07:37PM (#28342556)
I haven't yet seen a DSL that wasn't a big improvement over compiling the DSL to a bunch of boilerplate in my head and making everyone try to reread the boilerplate forever.
Re:Weird Languages by lifeisstillgood on Saturday August 28, 2021 @12:00PM (#28339066)
Please tel us more - a DSL in python is ... fun ... and having a real world use is cherry on top
Re:Weird Languages by skytreader on Saturday August 28, 2021 @06:20PM (#28342028)
Flattered by your interest but now I'm afraid the words "DSL" and "Lisp-like" might've given the impression of far more complexity than the project actually was. Keep in mind the core engine is ~200LoC. Maybe twice that at most. But really, there were far more rules than engine logic in the end.

The project was started for legal compliance so I don't want to go into specifics in case I make a slip one way or another. It did not run in the production cluster per se but was important nonetheless. (Actually, gods forbid it run in production!)

Very vaguely, it simplified structured data. A rule is recursively defined, base cases being simple rules that just returned primitive data. The original data could be an object with deep properties but most rules just simplified it to one with less fields.

I call it "Lisp-like" because after writing a handful of recursive rules, I had flashbacks of when I studied (actually) Scheme in uni. The tree-structure and meta-rules certainly gave that impression. I did not parse parens though, rather the rule syntax is JSON dictionaries. I hope this aided in readability---it should be self-explanatory what each rule did---and so my team did not find it too esoteric.

I don't remember the exact volume of data we processed but it was in the tens of GB, if not low hundreds. We parallelized it and had maybe 20 runners working concurrently. You can claim mapreduce (ha!) at this approach but honestly I think we could've parallelized it as easily if I did not go with this DSL-approach. :)

Re:Weird Languages by sanderjd on Saturday August 28, 2021 @11:19AM (#28338726)
Declarativeness targeting a specific problem is definitely good, but it is implementable in any language.
Re:Weird Languages by a4isms on Saturday August 28, 2021 @12:16PM (#28339208)
You have touched on what is both the best and the worst thing about programming languages in 2021.

On the one hand, most modern languages are powerful enough that you can build whatever you want on them. DSLs, constraint solving, pure FP, CPS, logic programming, whatever you like.

On the other hand, languages are subject to network effects. If you build an FP system on top of Python and I build one on top of Ruby, the resulting “FP frameworks” will be almost entirely incompatible. That makes it hard for people coming to either of our projects to “pick it up."

It’s great fun to implement your own library or framework that in turn implements something interesting, but everyone doing that leads to applications that are built on top of in-house home-grown greenspunned code bases.

In most production situations, it’s better to find the language and framework that already cater to the idiom you like, and come with a community of like-minded programmers who are familiar with how things work.

Network effects matter at scale, even if they’re irrelevant for a passion project.

The notion that any language can be coerced into supporting any programming idiom is true in theory, “But the difference between theory and practice is narrower in theory, than it is in practice.”

So I suggest there is still a lot of value in selecting the language/framework/library that was built to do the thing we want, right off the bat, and comes trailing a community and ecosystem around it.

Re:Weird Languages by novok on Saturday August 28, 2021 @03:35PM (#28340815)
Lisp Macros making DSLs have similar issues, your DSL doesn't work with the other guy's DSL trying to solve a similar issue.
Re:Weird Languages by a4isms on Saturday August 28, 2021 @06:13PM (#28341979)
When we use a system built around programming model X to implement programming model Y, and then write our program Z using model Y on top of model X, we are deliberately implementing the “Inner Platform Effect.”

https://en.wikipedia.org/wiki/Inner-platform_effect

Re:Weird Languages by jimbokun on Saturday August 28, 2021 @01:04PM (#28339585)
Sure, you can always implement a Lisp compiler in Java.
Re:Weird Languages by emodendroket on Saturday August 28, 2021 @11:03AM (#28338599)
On the other side of the ledger, the Sapir-Whorf hypothesis is widely considered discredited by linguists.
Re:Weird Languages by skytreader on Saturday August 28, 2021 @11:28AM (#28338803)
Has it? I'm genuinely curious to know. "Widely considered discredited" sounds like it's met the same fate as ether or alchemy.

I commented on SWH a few months ago in HN too when another user, claiming background in linguistics, replied that it factors in your world view but not as huge a factor as other cultural considerations. That sounded reasonable.

So as of the last time I looked up SWH (a few months ago), my knowledge of its consensus is that:

- the weak form ("relativism") is true to a certain extent, and definitely not to the extent Whorf originally proposed.

- the strong form ("determinism") is largely debated and, personally, I think it's indefensible as a thesis.

Re:Weird Languages by emodendroket on Saturday August 28, 2021 @11:37AM (#28338872)
When I took linguistics classes in school it was summarily brushed off, but here's how Wikipedia summarizes:

> The strong version, or linguistic determinism, says that language determines thought and that linguistic categories limit and determine cognitive categories. This version is generally agreed to be false by modern linguists.

> The weak version says that linguistic categories and usage only influence thought and decisions. Research on weaker forms has produced positive empirical evidence for a relationship.

Re:Weird Languages by coldtea on Saturday August 28, 2021 @01:08PM (#28339619)
Well, DUH! Did anybody put forward the first version which sounds like a strawman?

"language determines thought and that linguistic categories limit and determine cognitive categories. This version is generally agreed to be false by modern linguists"

The use of words like "determine" appears to make it look bogus. Whereas "influences" basically means the same thing (in practical terms, strongly influences is just as good as determines).

Re:Weird Languages by Karrot_Kream on Saturday August 28, 2021 @03:32PM (#28340793)
> Well, DUH! Did anybody put forward the first version which sounds like a strawman?

A lot of proto-linguistic (I say proto because linguistics want a real discipline yet) thought in the '50s-'60s did actually believe this. It was the informal basis for teaching lots of colonized peoples Western languages. It was the basis for the book 1984's Newspeak. It was also the hypothesis that motivated the creation of the Loglan (predecessor to the more well known, but still obscure, language Lojban) language. That you find this to be a strawman argument is a good testament to how widespread the knowledge of its disproval has become.

N.B. I also think in the pop programming language world (e.g. Twitter rants) that a lot of folks genuinely believe something similar to Strong Sapir-Whorf, at least as applied to programming languages.

Re:Weird Languages by ScottBurson on Sunday August 29, 2021 @04:04PM (#28349994)
Having actually worked with James Cooke Brown on Loglan (I wrote the first Yacc grammar for it), I have to say my recollection is that Jim's view was more tentative and nuanced than you've made it sound. While we certainly enjoyed finding things that seemed easier to say in Loglan than English, I don't recall him ever suggesting that there might be a thought that a non-Loglan speaker couldn't think.

I think it would be fairer to say that he was convinced that Whorfian effects were strong enough that there would be value in engineering a language to take advantage of them. But while value is somewhat in the eye of the beholder, I would say this hypothesis has not held up well either.

Re:Weird Languages by Karrot_Kream on Sunday August 29, 2021 @04:09PM (#28350026)
Thanks. My understanding was that Loglan was simply a mechanism to play around with the Sapir-Whorf theory among humans, but thanks for the additional context/correction.
Re:Weird Languages by TeMPOraL on Saturday August 28, 2021 @02:54PM (#28340499)
Well, based on my own introspection, the strong version looks obviously true to me - so I'm glad someone took time to disprove it.

When I read the description, I understand "determines" as in, your thoughts internally work in terms of language processing, so their complexity is limited to the complexity of the language(s) you know. It sounds plausible, but also testable by checking if humans who never learned a language with complex grammar are capable of processing complex concepts.

Re:Weird Languages by formerly_proven on Saturday August 28, 2021 @05:36PM (#28341734)
For a long time in human history people did not accept the existence of negative numbers; a Greek mathematician couldn't solve x+1=0 for example (this one also has "zero" in it, which also did not exist for some mathematicians). This seems like a decent example for linguistic categories limiting the thinkable categories. Other Greek examples: Zeno's paradoxes, irrational numbers, ...
Re:Weird Languages by coldtea on Saturday August 28, 2021 @06:04PM (#28341915)
>This seems like a decent example for linguistic categories limiting the thinkable categories.

As in absolutely limiting them, though? Like the Ancient Greeks, those who invented zero, didn't have it previously in their language, and couldn't do zero-based equations before either.

Re:Weird Languages by emodendroket on Saturday August 28, 2021 @07:50PM (#28342635)
Seems like a bad one. New concepts are given new names, or borrowed names, when they’re introduced. The first guy to come up with zero didn’t speak a language with a word for zero at the time.
Re:Weird Languages by coldtea on Saturday August 28, 2021 @06:09PM (#28341952)
>I'm glad someone took time to disprove it

What do you think "disprove" means in this context though?

E.g. do you think they really settled anything, the way we can prove a math theorem or verify some physical theory to hold (as a predictive model) to the nth degree of precision?

>When I read the description, I understand "determines" as in, your thoughts internally work in terms of language processing, so their complexity is limited to the complexity of the language(s) you know.

That would mean that developing further language is impossible or even that developing the first languages would be impossible - as those nearly language-less peoples have no means to develop those more complex later concepts.

It's not like e.g. Europeans (let's take them as a model of "advanced" language) emerged in nature in fully formed ancient Greek, Latin, English, French, etc.

They started with the same or even more "constrained" languages (verbally and conceptually) as any primitive people, and - going back to our forefathers - even language-less.

Re:Weird Languages by TeMPOraL on Saturday August 28, 2021 @08:08PM (#28342728)
> What do you think "disprove" means in this context though?

What it means for every scientific hypothesis: it takes infinite amount of evidence to positively prove it, but it takes one counterexample to kill it. +/- the usual uncertainty caveats.

> That would mean that developing further language is impossible or even that developing the first languages would be impossible

Not necessarily. It would mean that you can't think about some concepts without first extending the language to support them. Languages still could be extended piece by piece.

Re:Weird Languages by coldtea on Sunday August 29, 2021 @10:29AM (#28346984)
>What it means for every scientific hypothesis: it takes infinite amount of evidence to positively prove it, but it takes one counterexample to kill it. +/- the usual uncertainty caveats.

Only in such soft sciences you can "prove" any number of competing hypothesis, and have fractions arguing about them for decades or centuries. And whether a "counter example" is valid and "kills" a theory, will be a matter of interpretation and endlessly debated as well.

>It would mean that you can't think about some concepts without first extending the language to support them. Languages still could be extended piece by piece.

If you can always extend a language to new concepts, the language is not limiting in the strong SWH sense. If it was it would be impossible to reach those concepts from a reduced set of concepts.

Re:Weird Languages by emodendroket on Sunday August 29, 2021 @12:24PM (#28348057)
> Only in such soft sciences you can "prove" any number of competing hypothesis, and have fractions arguing about them for decades or centuries.

It took millennia for spontaneous generation to be definitively disproven.

Re:Weird Languages by coldtea on Monday August 30, 2021 @03:29AM (#28353459)
That's exactly my point, as that was before we settled on the scientific method.

So this might have been relatedto biology (or in other domains physics, chemistry, and so on), but the matter was debated in the soft sciences way, not in the way we do biology in the 20th century.

Re:Weird Languages by emodendroket on Monday August 30, 2021 @11:12AM (#28356386)
It was actually a few hundred years after the modern scientific method because scientists attempting to apply the method failed to spot confounding factors and interpreted their results incorrectly, something I think is hardly impossible even today in even the hardest of supposed hard sciences.
Re:Weird Languages by _emacsomancer_ on Saturday August 28, 2021 @02:05PM (#28340108)
Alchemy is a bit more reasonable.

Even the weak version falls apart under scrutiny. Here's a nice example of this: https://cpb-us-w2.wpmucdn.com/web.sas.upenn.edu/dist/4/81/fi...

This is a good example of a case where there was a phenomenon (a language prominently using non-speaker-oriented direction terms, and correlations with real-world behaviour of speakers of that language) which seemed to support a weak version of SW, but it turns that seemingly supporting evidence was really just a by-product of the testing environment.

Re:Weird Languages by skytreader on Saturday August 28, 2021 @03:36PM (#28340830)
I'm not sure how the study you linked is an indictment of the weak version. It seems to fall well under my understanding of the consensus that the weak version is only true to a certain extent and definitely not to the extent Sapir and Whorf originally claimed.

So this does present an interesting result, and one that (AFAICT---I am not a linguist by training) does run counter to the claims of SWH but, more importantly, the study is limited only to spatial reasoning. Surely there are more areas of thought than that?

Re:Weird Languages by _emacsomancer_ on Saturday August 28, 2021 @03:57PM (#28340998)
The study shows that differences in systems of direction words doesn't really affect spatial reasoning.

Yes, this one study doesn't disprove every aspect of SWH, but it's a good example of how SWH claims, even in the weaker versions, tend to fare when subject to more rigorous investigation & analysis.

What area of thought do you think provides good evidence for (some version of) the SWH?

Re:Weird Languages by lanstin on Sunday August 29, 2021 @03:45PM (#28349825)
Given that language is also created or modified by people in order to get their ideas across, wouldn’t it make sense if one can have thoughts arise that don’t fit into language but then they cannot be shared without the creation of appropriate language. I often have the experience of having ideas that I have in a sort of mathematical reasoning space (this here makes that there impossible) that I have to translate into English. (Eg If the the call is routed at the IP layer then they can’t reach this no matter what DNS they have access to)
Re:Weird Languages by _emacsomancer_ on Sunday August 29, 2021 @06:18PM (#28351002)
People do, of course, create new vocabulary, but that's not modifying language on a deep level. And, in part that's a convenience: even when you don't have a "word" for something, you can generally describe it. But if it's something you're going to refer to frequently having a nice lexical entry for it is more convenient. We have memory limitations, so sometimes having convenient handles can free up resources.

And your example, I think, also speaks to the point: you're able to reason in mathematical ways; being a speaker of English doesn't block this, even though English perhaps doesn't offer convenient vocabulary for this in all cases.

Re:Weird Languages by coldtea on Saturday August 28, 2021 @01:07PM (#28339612)
On the other hand, it's not like linguists are doing exactly a hard science, and their discrediting something means much, especially when it touches totally unrelated domains like psychology and neuroscience.
Re:Weird Languages by _emacsomancer_ on Saturday August 28, 2021 @02:07PM (#28340122)
Sometimes, when it's a field well outside of your area of expertise, not making pronouncements can save embarrassment later on.
Re:Weird Languages by coldtea on Saturday August 28, 2021 @02:47PM (#28340437)
My sentiments exactly (only on the other side).

You seem to respect everything labeled academic, but not all "areas of expertise" and not all "fields" are equally valid -- and surely not just because they are taught in universities, written about in "peer reviewed" journals, and so on.

Linguistics is closer to soft sciences than the opposite.

Re:Weird Languages by _emacsomancer_ on Saturday August 28, 2021 @02:58PM (#28340531)
> You seem to respect everything labeled academic,

I assure you, I really don't.

> but not all "areas of expertise" and not all "fields" are equally valid -- and surely not just because they are taught in universities, written about in "peer reviewed" journals, and so on.

Fully agreed.

> Linguistics is closer to soft sciences than the opposite.

"Linguistics" spans a range of things from the humanities to the 'soft' sciences (in the sense that psychology and cognitive studies 'soft' sciences) to logic/maths.

Re:Weird Languages by emodendroket on Saturday August 28, 2021 @01:26PM (#28339778)
If we want to take this into a more concrete and measurable realm, every programming language is going to get converted into the same machine code before it is run, so it is quite untrue that there is any idea that "cannot be expressed" in one programming language but can be expressed in another. It may be more or less convenient to do but nothing like the strong Sapir-Whorf hypothesis for human languages.
Re:Weird Languages by coldtea on Saturday August 28, 2021 @01:33PM (#28339838)
Well, in programming yes.

Though even in programming, there are e.g. non turing complete languages (e.g. simple regex languages), languages without certain high level facilities (making it much harder to organize your code in terms of certain concepts - analogous to organizing your thinking of the world around certain concepts -, which is a SWH-like effect), languages that can't express e.g. infinite loops and are certain to terminate (used e.g. for business logic, templating, etc), and so on.

Even if it all goes down to assembly, a language like Cobol might it much harder to write e.g. a 3D game. And that can be enough for games not be written in that language - it doesn't have to be impossible, just hard, which is enough to discourage most, aside from a few weirdos writing games in Cobol and compilers in bash.