Chipping in on pushfirst/popfirst

(First-time poster here and new to Julia; adoring the language’s patent elegance and the community’s drive!)

I wanted to chip in a few thoughts on the naming of “pushfirst!”/“popfirst!”. This convention was agreed to after thoroughly weighing the alternatives (juggling, among others, with notions like “behead” and even the hilarious “curtail” as “pop”-alternative).

I am actually quite OK with “pushfirst!”/“popfirst!”: no new words and using the established associations of push/pop with in/out; the neutral “first” classifier seems better-suited than some metaphor-laden alternatives (head, front, left…); and the ungodly “unshift!” is merrily dodged.

So this is settled and I would not venture to propose a change, and anyway, one can easily define synonym… still, to me, it. somehow. irks. The sheer beauty of Julia seems just ever so slightly tainted by

x = popfirst!(X)

There just /ought/ to be a snappier term if I want to chop off or put in some foo at bar’s head.

So I just want to sound out your opinion on the following shortcut monikers, especially with regard to the associations they evoke in native English speakers (non-native here).

Alliterating alternatives A)
shift!
shove!
=>

  • At least only one novel word (“shove”), as “shift” could be considered established. (I guess “shift” had mainly been held hostage by its wicked twin “unshift”.)

Alliterating alternatives B)
chop!
chip!
=>

  • Unfortunately, two novel words.
  • But “chop” hints at “chop off head”, i.e., the correct side/direction; its inner “o” character evokes the “Out”-concept (like “pop”).
  • Here, “chip” is meant to be understood in its (American?) “to chip in” flavor. It also has its inner “i” character evoking the “In”-concept. Yet, yet, the word “chip” also seems to be usable in an unwelcome “chip/chisel away” variety… so I am unsure if the wished-for “chip in”-spin dominates at first glance with native speakers.

So even if this caravan has gone – any thoughts (especially on your “chip”-feelings) would be appreciated!

1 Like

Non-native English speaker here too, but anyway…

I personally don’t like the idea of extending the namespace of functions with more synonyms. If an improvement for the nomenclature of those functions was looked for, I’d rather simplify everything to variations of insert! and splice!, and forget pop!, push! and relatives, like this:

insertfirst!(args...) = pushfirst!(args...) 
insertlast!(args...) = push!(args...)
splicefirst!(args...) = popfirst!(args...)
splicelast!(args...) = pop!(args...)

The proposal of chop! is specially unfortunate, since it is too much like Base.chop:

https://docs.julialang.org/en/v1/base/strings/#Base.chop

2 Likes

OP,

Please note that though Julia is still a relatively "Young’ language, it is not at “that stage” of development anymore. See here.

3 Likes