logoalt Hacker News

mihaic07/31/202512 repliesview on HN

It's become a pet peeve of mine, but for the love of God, if anyone with input in Carbon is scanning this, what can be done to use "func" instead of "fn" as a keyword?

That all-consonant keyword always makes it seem like I'm reading Hungarian notation when reading Rust for instance. An other options I've seen for instance in Pony, "fun", is already an English word with a completely different meaning.

Even the "function" from Javascript seems fine to me.


Replies

treyd07/31/2025

What's wrong with fn? It's perfectly understandable. I don't understand what the bikeshedding about keywords like this is about.

show 2 replies
seanw44407/31/2025

I kind of appreciate fn, personally. It's nice having function declaration lines with two less unnecessary characters in their length.

lvass07/31/2025

I use emacs' prettify-symbol mode to turn every language's function keyword into ʩ. Don't think I incurred in God's wrath just yet.

show 1 reply
pton_xd07/31/2025

How about "proc"? Too different? I don't like fn either but function is too much. Fun and func aren't great either. I'd go with proc or fn.

show 2 replies
cyber107/31/2025

"func" is fine; "function" is too long. "fn" is also good, but for example, Go was designed with "func," and it's one of the most successful, readable languages in the world, so why not?

mckravchyk07/31/2025

C++ does not have a function keyword at all, I wonder why did they add it in the first place.

show 3 replies
munchler07/31/2025

F# uses “fun” and I like it. The vowel does help a bit and I never confuse it with the English word. The worst one IMHO is Haskell’s “\”.

bhawks07/31/2025

Since interop is such a big design goal I wonder if fn was chosen after analyzing the impact of alternative keywords present in large c++ code based that would impact interop in a negative way (eg requiring more escaping).

zigzag31207/31/2025

I like it the most when there's no keyword. Just name() and return type.

dismalaf07/31/2025

Pony's keywords are the best. "fun" and "be" are just, well, fun lol.

I agree, I hate fn. Also not a fan of func though.

gpderetta07/31/2025

In C++ you can use indifferently either the class or typename keyword to introduce template arguments (because of course you can). A lot of styleguides suggest using typename because class is slightly misleading (the type could be anything not just a class).

In practice everybody just uses class, because who as the time to type the full keyword and signature declarations in C++ are already unwieldy as it is.

show 1 reply
flohofwoe07/31/2025

Tbh, I wonder why modern languages still have a function keyword at all, e.g.:

    const add = (a: i32, b: i32): i32 => a + b;
...or any variation of the arrow-function idea...
show 6 replies