Partial Expression proposal

# Tamás Halasi (6 years ago)

It's like the functional application proposal, just for any expression. See the proposal: trustedtomato/proposal-partial-expression

What are your thoughts?

# Mike Samuel (6 years ago)

On Wed, Dec 27, 2017 at 1:43 PM, Tamás Halasi <trusted.tomato at gmail.com> wrote:

It's like the functional application proposal, just for any expression. It would improve

This sentence ends abruptly. What would this proposal improve?

See the proposal: trustedtomato/proposal-partial-expression

What are your thoughts?

Is this lambdas with De Bruijn indices?

The proposal says """The ? token is used in conditional expressions, but its not ambiguous, because in this proposal, a ? cannot follow an expression, while in a conditional expression it always does."""

You have ?? and ??? for referring to outer layers. Is there no ambiguity there?

? ? ? : ?

may not be ambiguous, but without the spaces it would require lookahead to the ":" to resolve ambiguity, unless the tokenizer starts to consume maximal runs of question marks.

# Tamás Halasi (6 years ago)

This sentence ends abruptly. What would this proposal improve?

Oops, I accidentally pressed Send... So, it would improve functional programming in general, the examples are in the README.

Is this lambdas with De Bruijn indices?

Hmm, I haven't heard of them yet, but by looking at the surface, they seems to be similar.

You have ?? and ??? for referring to outer layers. Is there no ambiguity

there?

That's a very good point! I haven't thought of that. I can't think of a solution, the lookahead is indeed very bad. I opened an issue trustedtomato/proposal-partial-expression#4. I

think the notation (for accessing arguments from outer layers) will have to be changed / removed.

Thanks for the feedback! :)

# Isiah Meadows (6 years ago)

My concern: I get the concept, and could see how at the first level (e.g. #? + ?) it could be useful, but I can tell you that this doesn't look especially obvious, and starts to look almost like the line noise of some Perl or APL 1/J 2/etc.:

// Example 1:
let foo = #foo(#???:??)

// Example 2:
let constant = ##??

// Example 3:
let makeAdder = ##?+??

And I agree with Mike in that it does remind me of De Bruijn indices. Those are nice in binary encodings, but they tend to start looking like line noise after sufficient depth. (An entire esoteric language has been formed based on this whole thing: Binary Lambda Calculus 3.)

Oh, and this will most certainly conflict with the stage 3 private property proposal:

let bar = () => console.log("outer")

class Foo {
    #bar = () => console.log("inner")

    method() {
        // Should this return a thunk or log "inner"?
        list.map(##bar(1, 2, ?))
    }
}

Isiah Meadows me at isiahmeadows.com

Looking for web consulting? Or a new website? Send me an email and we can get started. www.isiahmeadows.com

# Tamás Halasi (6 years ago)

Hmm I see. I'll definitely remove the multiple ? marks and keep it one level. And change the # to something else... For example, §. With these changes, is there anything which should be changed?

2017-12-27 21:17 GMT+01:00 Isiah Meadows <isiahmeadows at gmail.com>:

# Sebastian Cholewa (6 years ago)

On PC writing “§” character wouldn’t be convenient, as it’s not on
keyboard. One would has to copy and paste it. I see this as problematic.
Writing code should not require any extra acrobatics with set of
characters.

To be more constructive, available characters are:
!@#$%^&*()_+-=[]{};:'",<.>/?

W dniu .12.2017 o 21:56 Tamás Halasi <trusted.tomato at gmail.com> pisze:

# Alexander Jones (6 years ago)

The real JavaScript 'character wall'.

# Tamás Halasi (6 years ago)

Do you think \ would be a good replacement for #? It is currently illegal outside string literals as far as I know.

2017-12-28 1:23 GMT+01:00 Alexander Jones <alex at weej.com>:

# Isiah Meadows (6 years ago)

Except it's not. The identifier foo\u0048 is equivalent to fooA, for example.

Isiah Meadows me at isiahmeadows.com

Looking for web consulting? Or a new website? Send me an email and we can get started. www.isiahmeadows.com

# Tamás Halasi (6 years ago)

Damn. I wonder why is that useful. But whatever.

What symbol do you think would be the best? A binary operator have to have an expression at its left side, so *, /, %, >, <, &, ^ or | might be good.

2017-12-28 16:19 GMT+01:00 Isiah Meadows <isiahmeadows at gmail.com>:

# Mike Samuel (6 years ago)

On Thu, Dec 28, 2017 at 12:10 PM, Tamás Halasi <trusted.tomato at gmail.com> wrote:

Damn. I wonder why is that useful. But whatever.

What symbol do you think would be the best? A binary operator have to have an expression at its left side, so *, /, %,

, <, &, ^ or | might be good.

If we focused on whether the feature set is desirable given the balance of existing features and use cases, we could later bikeshed after we're informed enough to weigh the benefit vs cost of consuming available punctuation.

# Tamás Halasi (6 years ago)

How could we find out whether the feature is desirable? Just find a lot of use cases? Or write a Purpose paragraph?

2017-12-28 20:29 GMT+01:00 Mike Samuel <mikesamuel at gmail.com>:

# Mike Samuel (6 years ago)

Maybe take a shortish but non-trivial piece of code, rewrite it to use the proposed syntax. Then explain what about the rewritten code makes it clearer, more maintainable, etc. than the code before.

On Dec 28, 2017 2:44 PM, "Tamás Halasi" <trusted.tomato at gmail.com> wrote:

How could we find out whether the feature is desirable? Just find a lot of use cases? Or write a Purpose paragraph?

2017-12-28 20:29 GMT+01:00 Mike Samuel <mikesamuel at gmail.com>: