Php supports kebab-case variables: ${"variable-name"}=123; Isnt it beautiful?
How many languages support kebab case with any Unicode dash that isn't the ASCII one? :)
Microfeatures I'd like to see in more languages
11–20 of 539 posts
Re: Microfeatures I'd like to see in more languages
#12Re: Microfeatures I'd like to see in more languages
#13My favorite is uniform function call syntax. In several languages (Nim, Koka, D, …), you can always write bar.foo(baz) instead of foo(bar, baz) and vice-versa. Another one from Nim is the implicit result variable. Instead of having to do this: func sum(nums: seq[int]): int = var result = 0 for num in nums: result += num return result you just do this: func sum(nums: seq[int]): int = for num in nums: result += num It…
https://status-im.github.io/nim-style-guide/language.result....
Re: Microfeatures I'd like to see in more languages
#14I have long wondered why Ruby's symbols aren't in every language.
Is it for performant reason ?
I guess it's similar to Python having a single instance of small integers. PlayStation also experimented with caching small floats which gave them some perf improvements too, but I think wasn't as performant in all cases.
Re: Microfeatures I'd like to see in more languages
#15I hate this so much. It means I can't grep for a constant.
Re: Microfeatures I'd like to see in more languages
#16Php supports kebab-case variables: ${"variable-name"}=123; Isnt it beautiful?
How many languages support kebab case with any Unicode dash that isn't the ASCII one? :)
I suspect java would work as well, not sure about golang unicode var naming.
Re: Microfeatures I'd like to see in more languages
#17f[x]
f@x
x // f
It matches the flow of thought more naturally when hammering out a couple of one-liners.
Re: Microfeatures I'd like to see in more languages
#18I have long wondered why Ruby's symbols aren't in every language.
1. mutable strings (ruby)
2. and / or expensive strings (erlang, also non-global)
If you have immutable "dense" strings and interning, and you automatically intern program symbols (identifiers, string literals, etc...) then symbols give you very little.
And then there's the slightly brain damaged like javascript, where symbols are basically a way to get some level of namespacing to work around the dark years of ubiquitous ad-hoc expansions so you're completely stuck unable to add new program symbols to existing types because you could break any page out there doing something stupid.
Re: Microfeatures I'd like to see in more languages
#19I really liked the postfix and prefix notation in Mathematica. These three all mean the same: f[x] f@x x // f It matches the flow of thought more naturally when hammering out a couple of one-liners.
Re: Microfeatures I'd like to see in more languages
#20Clojure’s loop expression hits this spot for me. It sets a recursion point to which you can jump using any logic inside the body you want, as long as it is from tail position. It’s like a while loop turned into an expression. I haven’t encountered any other way to write iterative expressions whose number of iterations isn’t known at the top (like map and reduce).
Job done