alex / bagel

Bagels are delicious
BSD 3-Clause "New" or "Revised" License
22 stars 1 forks source link

consider replacing "->" sigil with a word that can be read #53

Open glyph opened 10 years ago

glyph commented 10 years ago

When considering #52, I realized that -> is unnecessarily difficult to pronounce. It bothers me because it obviously wants to be "→" but isn't because of limitations on keyboards rather than comprehensibility. Bagel Fuhmpt could of course format this as an arrow, which would be an improvement, but better yet, I think, would be to change

    def translate(self, dx: Int, dy: Int, dz: Int) -> Point:
        return Point(self.x + dx, self.y + dy, self.z + dz)

to

    def translate(self, dx: Int, dy: Int, dz: Int) returns Point:
        return Point(self.x + dx, self.y + dy, self.z + dz)

since that is how I would pronounce the sigil; what you are saying about the signature is that it returns Point, so... why not just spell that out with a word?

frewsxcv commented 10 years ago

I'm not sure how functional Bagel is going to be, but in functional languages, it's not uncommon to see code that looks like

val d = fn : (real -> real) -> real -> real

Compared to

val d = fn : (real returns real) returns real returns real

I do like your idea though, just trying to think how it'd look as a function type signature

alex commented 10 years ago

Bagel is not going to be that function, chains of -> will be uncommon.

glyph commented 10 years ago

This does raise the question of how one declares an argument of a particular signature though. What does a higher-order function look like in Bagel?

alex commented 10 years ago

You're asking what the "type" of a function is?

On Mon, Oct 20, 2014 at 11:52 AM, Glyph notifications@github.com wrote:

This does raise the question of how one declares an argument of a particular signature though. What does a higher-order function look like in Bagel?

— Reply to this email directly or view it on GitHub https://github.com/alex/bagel/issues/53#issuecomment-59820124.

"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084

glyph commented 10 years ago

Yes, I guess, although only in the context of what the literal spelling of a signature for a callable parameter passed to a function would look like.

alex commented 10 years ago

Let's say it's Function[*args, returns=...] (I don't have a clue wha tthe right answer is)

On Mon, Oct 20, 2014 at 3:17 PM, Glyph notifications@github.com wrote:

Yes, I guess, although only in the context of what the literal spelling of a signature for a callable parameter passed to a function would look like.

— Reply to this email directly or view it on GitHub https://github.com/alex/bagel/issues/53#issuecomment-59849132.

"I disapprove of what you say, but I will defend to the death your right to say it." -- Evelyn Beatrice Hall (summarizing Voltaire) "The people's good is the highest law." -- Cicero GPG Key fingerprint: 125F 5C67 DFE9 4084