لي عندهٌ مية يقول يا ميتين
li `andu mya yqul ya mitin
who has hundred says oh two.hundred
He who has a hundred says "If only it were two hundred!" (literally: "Oh two hundred!")
The ya here is not a general-purpose interjection. Unlike English "oh", it's normally used as a vocative, followed by the name of the person you're addressing. That's its primary function in Classical Arabic too. But in Classical Arabic, you can't use it on its own to mean "if only..."; in fact, that usage isn't very common in Algerian Arabic either. Yet the same extension of function from vocative to wish-marker is found in Algerian Berber. In an 18th century Kabyle poem recorded by Mouloud Mammeri in his Poèmes kabyles anciens (p. 132), an aspiring poet, Muh At Lemsaawd, begs the better-established Yusef u Qasi to accept him as an apprentice:
Ul-iw fellak d amaalal
A wi k-isâan d ccix is
My heart is sick for you
If only I had you as my teacher (literally: "Oh he who has you as his teacher!")
You can't do this in Classical Arabic, nor in English: a vocative followed by a noun phrase is going to be interpreted as an act of addressing, not of wishing. But in Arabic you do find an otherwise unexpected vocative particle showing up in some wish constructions, notably يا ليت yaa layta "if only". And in (slightly archaic) English you have a very similar construction with an infinitive in "to" or a prepositional phrase in "for", instead of with a noun phrase: "Oh to be young again!", "Oh for a thousand tongues to sing!" That suggests that the connection between vocative and wishing reflects some general feature of human cognition, or at least of a rather large culture area.
The obvious connection would be through requests. One reason to address someone is to ask them to bring you something. It's not such a big step from "Hey kid, get me a glass of water" to "Hey, a glass of water!", with the addressee and the verb erased, and the vocative particle effectively serving as much to mark the wish as to get the addressee's attention. But that doesn't really predict forms like the Kabyle one, where the state wished for takes the form of a relative clause, nor even the old-fashioned English constructions discussed, so I'm not really happy with this explanation. Any ideas? And can you think of any parallels in other languages?