In Anders first talk on TypeScript, he uses the phrase 'idiomatic javascript" several times.
What is the definition of idiomatic as it is used here?
I have looked this up on Wikipedia, SO search etc, but still feel I don't fully understand what the word means in this context.
Greg
So, in software engineering “idiomatic” means “conforming to the natural mode of expression in a given context”, where that context can be a programming language, like Kotlin or JS, or even a framework like React or RxJava.
Idiomatic and non-idiomatic meaningsThe same expression or phrase can be used in more than two contexts. The word "break" has many meanings. The literal meaning is called non-idiomatic meaning and the other formed phrases (noun + preposition / verb + preposition) have idiomatic meanings.
peculiar to or characteristic of a particular language or dialect: idiomatic French. containing or using many idioms. having a distinct style or character, especially in the arts: idiomatic writing; an idiomatic composer.
An idiomatic expression is a turn of speech that makes sense in one language, but if translated literally into another no longer makes sense. Some examples: put out the cat, put out the light, take a walk, take a bath, take a moment. The use of English prepositions is largely idiomatic.
Idiomatic here means "How people who write JavaScript write JavaScript".
It means "Natural to the native speaker".
For example, returning an object is considered by some idiomatic JavaScript:
function foo(){ return {x:3,y:5}; } var point = foo();
While "out parameters" are considered less idiomatic:
function foo(out){ out.point = {x:3,y:5} } var out = {}; foo(out); point = out.point;
Another example of idiomatic JavaScript is the use of closures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With