Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tease apart names and identifiers #250

Open
masak opened this issue Sep 8, 2017 · 8 comments
Open

Tease apart names and identifiers #250

masak opened this issue Sep 8, 2017 · 8 comments

Comments

@masak
Copy link
Owner

masak commented Sep 8, 2017

Here's another thing I would like to get in place pre-1.0, because a deprecation cycle would be less-than-fun afterwards: currently, Q::Statement (note the double colons) is a valid identifier in 007. This goes against the established definition of "identifier" in basically all languages.

In Perl 6, Q::Statement is called a name in the grammar. I just checked. We might borrow as much prior art from the Perl 6 grammar as we can here.

The <morename> token does a number of other things, like indirect lookup, that doesn't interest us right now.

@masak
Copy link
Owner Author

masak commented Sep 20, 2017

It's interesting to think what happens to dict keys. The sane default seems to be to allow only identifiers there, not whole keys. But then we lose the ability to have a key such as Q::Identifier (something that runtime.007 currently uses quite heavily, for example). Something tells me it's still the right thing to forbid this.

masak pushed a commit that referenced this issue Aug 7, 2018
This change charges some extra onto the already debt-ridden
'property' method in Runtime.pm6. It's overdue for some
cleanup; maybe even before one that affects the entire object
system.

In general, this change introduces technical debt here and
there, which can either be cleaned up gradually, or as part
of a bigger object system rework. Until then, we already
have the dot separator, and we've cleaned up `::` for other
things (such as a custom operator).

There are a couple of places in the language where previously
we expected "one identifier" denoting a type, but now it's a
chain of dot-separated identifiers instead; what #250 calls a
"name":

- After `new`
- After `quasi @`
- Before the `@` in unquotes

The "neat" shortcut in self-host/runtime.007 where we used
the Q hierarchy type "identifiers" as object/dictionary keys
had to go. But that was a price we had to pay at some point
anyway.

Closes #250.
Closes #298.
masak pushed a commit that referenced this issue Aug 7, 2018
This change charges some extra onto the already debt-ridden
'property' method in Runtime.pm6. It's overdue for some
cleanup; maybe even before one that affects the entire object
system.

In general, this change introduces technical debt here and
there, which can either be cleaned up gradually, or as part
of a bigger object system rework. Until then, we already
have the dot separator, and we've cleaned up `::` for other
things (such as a custom operator).

There are a couple of places in the language where previously
we expected "one identifier" denoting a type, but now it's a
chain of dot-separated identifiers instead; what #250 calls a
"name":

- After `new`
- After `quasi @`
- Before the `@` in unquotes

The "neat" shortcut in self-host/runtime.007 where we used
the Q hierarchy type "identifiers" as object/dictionary keys
had to go. But that was a price we had to pay at some point
anyway.

Closes #250.
Closes #298.
masak pushed a commit that referenced this issue Aug 7, 2018
This change charges some extra onto the already debt-ridden
'property' method in Runtime.pm6. It's overdue for some
cleanup; maybe even before one that affects the entire object
system.

In general, this change introduces technical debt here and
there, which can either be cleaned up gradually, or as part
of a bigger object system rework. Until then, we already
have the dot separator, and we've cleaned up `::` for other
things (such as a custom operator).

There are a couple of places in the language where previously
we expected "one identifier" denoting a type, but now it's a
chain of dot-separated identifiers instead; what #250 calls a
"name":

- After `new`
- After `quasi @`
- Before the `@` in unquotes

The "neat" shortcut in self-host/runtime.007 where we used
the Q hierarchy type "identifiers" as object/dictionary keys
had to go. But that was a price we had to pay at some point
anyway.

Closes #250.
Closes #298.
@masak
Copy link
Owner Author

masak commented Oct 30, 2018

I think the thing I just realized in #413 (comment) means that we should have a separate Q.Name type, which should consist of (handwave) an identifier plus zero or more strings.

@masak masak reopened this Oct 30, 2018
@masak
Copy link
Owner Author

masak commented Oct 30, 2018

And yes, I'm quickly coming to terms with the fact that the dot (.) in name's is not an operator, much like the = in (the late and great) Q.Statement.My wasn't an operator, or the = in (soon to be) parameter defaults won't be an operator.

We should have a name for all of these things that look like operators but aren't. "Quasi-operators"?

@vendethiel
Copy link
Collaborator

vendethiel commented Oct 30, 2018

Let's not use "quasi" ;). Fauxperators? Pseudoperators?

@masak
Copy link
Owner Author

masak commented Oct 30, 2018

Good point. Didn't think of that.

"Notperators"? "Snoberators"? "Floperators"? "Unperators"?

The problem with all of these is that they are a little bit too cute. I would prefer a term that's very boring, but that immediately gives the right impression.

Like something that in itself means "this isn't an operator; yes, I know it looks like one".

"Surrogate operators"?

@masak
Copy link
Owner Author

masak commented Oct 30, 2018

To be excruciatingly clear: when we parse foo.bar, the . in there might be an operator, or it might be a "module separator dot" which doesn't terminate the parsing of the name.

Two things need to hold for it to be the latter: foo needs to resolve to a value at compile time — and that value needs to type-match with Module.

@masak
Copy link
Owner Author

masak commented Oct 30, 2018

Thinking about this, I think that the Q.Name should primarily be defined by that Module, plus that last property access (a string). Whether we even need to store the names of the other things is an open question — and I'm going to default to "no" since it feels like spring too much.

@masak
Copy link
Owner Author

masak commented Oct 30, 2018

As a data point, IntelliJ calls this entity a reference expression. It also calls everything before the last dot (if any) a qualifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants