logoalt Hacker News

Brunost: The Nynorsk Programming Language

131 pointsby atomfingerlast Monday at 6:49 PM72 commentsview on HN

Comments

kingofmenyesterday at 6:14 AM

What the devil kind of "Nynorsk" allows "kalkuler" in place of "beregn"? And as the other poster pointed out, 'endre' does not actually take the '-leg' ending to make an adjective; not in the written language at least. Your dialect may allow it but that hardly matters. Try 'foranderlig', although I do like the idea of using articles. However, as we have three articles but variability is binary, I suggest we assign 'en' (masculine, firm, rigid) to constants, 'et' (neuter, indecisive, wibbly-wobbly) to variables, and of course 'ei' (feminine) as referring only to collections, into which things may be inserted. That does leave us with the difficulty of how to declare a collection as constant; I suggest

`ei fylke er alltid ["Vestland", "Rogaland", "Troms", "Finnmark"]`

which on second thought suggests that we can just have `alltid` as a const-modifier on `er`. Simpler.

Another point to note is that Norwegian does not allow the Oxford comma; correct grammar is "Johan, Fredrik og Martin". To follow this rule you should require the last separator of a list to be 'og':

`ei fylke er alltid ["Vestland", "Rogaland", "Troms" og "Finnmark"]`

show 2 replies
kreyenborgiyesterday at 5:47 AM

Funny :) but I think it would work better if the language not only required Nynorsk, but used Nynorsk and not Bokmål for all keywords:

https://ordbokene.no/nob/nn/ellers

I think I also saw "ikke" in there.

And https://ordbokene.no/nob/nn/endreleg isn't a word in any language? The Nynorsk word for it is sadly just "variabel". To make it more interesting, you could require agreement, and instead of "endreleg fart", how about just using the indefinite article for things that are changeable since things that are changeable seem kind of indefinite:

    ei fart = 70
    eit smell = "bang"
    eit fag = "naturfag"
    ein slutt = "."
And of course

    forKvar fart
    forKvar slutt
but

    forKvart smell
    forKvart fag
And if you mess up the agreement you get a red squiggly line, and for every such your grade goes down from 6 and if it's less than 2 your program fails.
show 1 reply
lrasinenyesterday at 6:49 AM

One of these years I'm going to make a Finnish programming language that enforces the correct case in arguments. And I don't mean silly arguments like camelCase vs kebab-case, I mean grammar.

Some examples to illustrate:

  tiedosto on "foo.txt" avattuna
  tulostin on PRN1
  kirjoita(tiedostoon, "a")
  kirjoita(tulostimelle, "b")
Job security for DECADES.
show 3 replies
skrebbelyesterday at 2:16 PM

I understand "fast fart er 80" and it makes sense, but I think present tense "er" for mutable variables is super weird, and implies functional semantics in an imperative world. Like eg this:

    endreleg fart er 80
This is weird! It can change but it is 80? Was it already? Will it forever? Should that maybe be "blir" instead? (pardon my nonexisting Nynorsk, I'm extrapolanorsking from Danish "bliver") Eg:

    endrelig fart blir 80
So that later it can become a different value, eg

    fart blir 90
And the imperative nature of this bit of code is immediately clear to the reader.
show 2 replies
yalokyesterday at 3:14 PM

For those in the USA - if you never tried brunost (brown cheese) - look at specialty cheeses of a larger grocery chain (Whole Foods, Safeway, …) - it’s called “Ski Queen” here, and is sold as a perfect cube in red/brown plastic pack.

It’s very delicious.

I was ecstatic when I found it quite a few years ago in a regular store. A Norwegian friend of mine used to send me a brick of this cheese once a year for Christmas, when I was a student, and I treasured it as one of the most valuable possessions :)

Also, fun fact - the reason this cheese tastes sweet is due to caramelization - the milk gets boiled for a long time (hours) to get the brown color and sweetness. So it’s completely natural, zero added sugar ;)

starefossenyesterday at 7:48 AM

If you have not tasted brunost you should definitely try it https://en.wikipedia.org/wiki/Brunost

show 1 reply
Kaliboyyesterday at 6:34 AM

After spending way too much time thinking about how I would program in a language I never heard about I realized that as a native Dutch speaker Nynorsk is fairly readable.

I'm sold.

show 1 reply
mstadeyesterday at 1:38 PM

As a Swede I am surprisingly drawn to this. At first I read this as a fun joke, an art project if you will. By the end after reading the code and being surprised by how comfortably it reads to me I find myself kind of wanting to use this. In a way it is exactly like brunost, surprisingly good.

show 1 reply
vidarhyesterday at 7:07 AM

> One can make similar arguments about Bokmål and Sami, but people speak Sami. And I would argue that a lot more people speak "pure Bokmål" than Nynorsk.

Very, very few. I used to, as a side effect of being quite asocial and reading a lot as a child, and reinforced by my dads very conservative dialect for western Oslo despite where we were living (half an hour drive out the other side of Oslo; dialects in Norway are very local - in that span you pass through at least one other dialect area). The dialect differences were significant enough that an exchange student in high school who was speaking close to perfect Norwegian toward the end of the year still struggled to understand me.

But even then, I adopted more and more of the regional dialect over time. Unless you're a hermit it's hard not to. And there are basically no place in Norway where the local dialect is pure Bokmål.

There might well be more people who can switch to speak pure Bokmål than Nynorsk, though, because it is the primary written language of far more people, and so its the easiest to slip into if you want to speak "formal" Norwegian. This was more pronounced before, when there was a tendency to see the written languages, and especially Bokmål, as more prestigious, and so you might hold a speech in Bokmål instead of your own dialect, TV presenters favoured "pure" Bokmål or Nynorsk instead of their dielcts etc. That's thankfully changed

show 1 reply
wodenokotoyesterday at 6:44 AM

“Fast” means firm or constant. “Fart” means speed.

The examples have nothing to do with quick flatulence.

show 1 reply
reerdnayesterday at 6:31 PM

This brings back good memories from when a friend made C in nynorsk: https://www.pvv.ntnu.no/~andreer/nynorsk/

vintermannyesterday at 12:58 PM

"endreleg"? Are you sure that word is in your own nynorsk dictionary?

show 1 reply
thomasflyesterday at 7:15 AM

The brunost programming language could be very useful for norwegian government agencies. It is common to use norwegian names for variables and functions at the Norwegian Labour and Welfare Administration (NAV in Norwegian). A subset of typescript where the reserved words are written in nynorsk, would help prevent misunderstanding.

show 3 replies
freekhyesterday at 6:33 AM

As a fellow Norwegian and nerd I have always wanted to be better at Nynorsk. Maybe this is what I need to get better at it!

show 1 reply
benj111yesterday at 9:22 AM

Slightly off topic.

"Now, the keyword fast here is saying that the variable fart cannot be changed - it is immutable"

So would this be the same 'fast' as you'd find in 'steadfast' or as in stuck?

show 2 replies
unixheroyesterday at 4:50 PM

Nynorsk destroyed my future

n0rlant1syesterday at 7:37 AM

Spenstig!! Mangler bare "endeleg" i Exception handling :)

show 1 reply
s1mplicissimusyesterday at 8:38 AM

I was somewhat skeptical, but this got me:

``` fast fartsgrense er 80 fast minFart er 90

```

tilt_erroryesterday at 8:25 AM

Eg saknar kvisleis.