News for hackers. Stuff that matters.
Re:Verb-Noun vs. Noun-Verb by rtkwe on Wednesday October 16, 2019 @03:49PM (#21274691)
Yeah I much prefer that style because it reads left to right like I naturally read as an English speaker. It flows more naturally from the original object and the changes applied to it.
Re:Verb-Noun vs. Noun-Verb by Twisol on Wednesday October 16, 2019 @04:11PM (#21274949)
Agreed. Some functional languages (like F#) have a pipelining operator |> that gives the same syntactic impression:

    list |> map (1+) |> filter odd |> sum
Re:Verb-Noun vs. Noun-Verb by the_gipsy on Wednesday October 16, 2019 @06:53PM (#21276898)
I have found myself using pipes many times in Elm, because they make the code so much more readable. Now I understand why!

I haven't seen an autocomplete that works on pipes. But with a good type system, it is technically possible to list all compatible functions that take "noun" as first parameter.

Sometimes you supply partially applied functions (also with pipes in noun->verb order) and that's not so easy to match:

noun |> verb1 |> (otherNoun >> verb2) |> etc

But perhaps even functions that take "noun" as nth parameter could be suggested.

Re:Verb-Noun vs. Noun-Verb by codr7 on Wednesday October 16, 2019 @06:36PM (#21276756)
And other languages, such as Forth; don't need one.

    list map filter odd sum
Re:Verb-Noun vs. Noun-Verb by Twisol on Thursday October 17, 2019 @12:04AM (#21278818)
Huh. I would've expected it to be `odd filter`, not `filter odd`.
Re:Verb-Noun vs. Noun-Verb by zwaps on Thursday October 17, 2019 @02:30AM (#21279438)
Interestingly enough, the now standard data manipulation package in R, dplyr, uses pipelines.
Re:Verb-Noun vs. Noun-Verb by karmakaze on Sunday October 20, 2019 @12:32PM (#21305162)
Good to learn me some F#, looks like Elixir.
Re:Verb-Noun vs. Noun-Verb by jodrellblank on Wednesday October 16, 2019 @04:21PM (#21275079)
If verbs from the object flowing you want, "That style to me is preferable" you should say. (Style is the object, preferring it is the verb)

English reads left to right overall, but writing instructions in English does not flow smoothly either way. e.g. "shuffle a deck of playing cards then deal four" reads more naturally than either "a deck of playing cards shuffle then four cards deal" or "deal four cards after shuffling a deck of playing cards".

shuffle(cards).deal(4) is a mix of both approaches.

Re:Verb-Noun vs. Noun-Verb by rtkwe on Wednesday October 16, 2019 @04:35PM (#21275250)
Yes yes, english doesn't follow this noun-verb order but that's not what I'm actually talking about.

Usually the languages either encourage cards.shuffle().deal(4) or deal(shuffle(cards),4).

In the 'noun-verb'/OOP version the sequence of modifications follows the english reading order where basically I only have to keep information about the last result in my head. The functional verb-noun version I have to pop in and out of layers: 'ok we're dealing what?, something shuffled, what are we shuffling?, the cards object/variable, ok we're dealing shuffled cards how many are we dealing? 4.'

In general the noun-verb follows the sequence of operations applied by the computer so it's easier to read.

Re:Verb-Noun vs. Noun-Verb by jodrellblank on Wednesday October 16, 2019 @04:48PM (#21275444)
That's where I was going as well, LISP style and APL style claims "reads left to right" but having to build up a stack of buffered work which you can only unwind once you get to the end, is annoying and unhelpful and limiting.

But simply turning it around to cards.shuffle().deal(4) isn't a good answer, it's still the case that you can only put a small number of things together in a chain because it stops making sense. If the next move was to start the game, "cards.shuffle().deal(4).startgame('some-card-game')" does not make sense because starting the game is not something the cards do, but "start(deal(shuffle(cards), 4), 'some-card-game')" can make sense because start is a function which takes a board state and a game to start. It describes the world state, not the cards and their abilities.

That is, neither style is right, but a mixed style where both approaches are available and you can mix and match to be more expressive, works much better, IMO. Chunking a small number of things with prefix into one operation, or with postfix into one operation, but combining those chunks flexibly at a larger scale.

Re:Verb-Noun vs. Noun-Verb by cb504 on Wednesday October 16, 2019 @05:06PM (#21275703)
the main point was about auto-completion and usability and discoverability. fluent api for the win.
Re:Verb-Noun vs. Noun-Verb by qtplatypus on Wednesday October 16, 2019 @10:23PM (#21278373)
English is worse as it is SVO. So a more English like language would be all infix operators. I thunk part of ambiguity is that English can be used in both modes.

“Say that” “He said”

Re:Verb-Noun vs. Noun-Verb by rtkwe on Wednesday October 16, 2019 @11:58PM (#21278789)
I was really just talking about the left to right order of modification not the actual order of English sentences. Apparently I was very unclear because that's all the responses I'm getting.