Replies: 13 comments 46 replies
-
Please note that the above is only for declarative usage of checks:
There have been plenty of discussions about using types in expressions, but I feel that's out of scope for the current MVP unless we find that it has an impact on the design of the MVP. |
Beta Was this translation helpful? Give feedback.
-
This syntax also let's you define multiple variables with a single type. I think we should stick to what was there before, if we had a room for Let's improve Perl, but not try to change's it's existing syntax fundamentally (as with Raku). Attributes and KIM is awesome in all other aspects (apart from variable and function parameters TYPE's). |
Beta Was this translation helpful? Give feedback.
-
On Mon, 3 Jul 2023, 12:00 Ovid, ***@***.***> wrote:
Initially attributes and a KIM syntax were proposed for data checks:
I am not familiar with the term KIM syntax. Is there a reference link I can
read?
Yves
|
Beta Was this translation helpful? Give feedback.
-
just stupid question - why not both? (ie: timtowdi)
and let user decide which syntax will be using (as we have with prefix / postfix |
Beta Was this translation helpful? Give feedback.
-
Ovid it isnt clear to me what trade offs we are dealing with here. If we choose KIM, would it be more usable than if we used type declarations? Right now as far as I understand it the trade off is that using type declaration would mean we can use one declaration for multiple variables, and if we used KIM we would have to repeat the declaration for each variable. Are there any other trade offs? Can we use type syntax in subroutine argument declarations, or is that restricted to KIM? My gut feeling we should choose the option that facilitates the maximum usefulness with the least need to modify the internals. |
Beta Was this translation helpful? Give feedback.
-
Prefix test case:
|
Beta Was this translation helpful? Give feedback.
-
Also, unless someone here objects, I plan to list everyone in the Toronto keynote as team members on the Oshun project. I'll try to use your github names and real names. If you'd like to be listed differently, or not at all, please let me know. |
Beta Was this translation helpful? Give feedback.
-
I prefer KIM syntax for the consistency with key-value pairs, where the name always appears on the left of what it is naming, whether it is named arguments or named hash keys. Also it is consistent with things like SQL where the field name is declared before the possibly numerous descriptors of it. Also, importantly, KIM syntax is consistent with Corinna field declarations. If you look at it in a more abstract sense, the check declaration is functionally like many other things that are currently attributes in Corinna field declarations. And KIM syntax I prefer visually because for the general case where check definitions may be long, it looks better for the long thing to be on the right, its like an arbitrary value expression. |
Beta Was this translation helpful? Give feedback.
-
Another thing to think about is how the syntax would look for defining checks with destructuring assignment. |
Beta Was this translation helpful? Give feedback.
-
Using KIM syntax seems sensible to me, especially since Corinna uses it also. |
Beta Was this translation helpful? Give feedback.
-
I'm a big fan of using the my TYPE IDENTIFIER syntax. It looks good and it's clean. It doesn't involve a syntax that'll be unfamiliar to nearly everyone coming from other languages, and as mentioned it allows multiple declarations in one statement. Trying to use params to implement a forward-thinking project seems like it'll hold Oshun back quite a lot. |
Beta Was this translation helpful? Give feedback.
-
I presume that at some future point we will also want an And then some way to lexically force |
Beta Was this translation helpful? Give feedback.
-
A quick and dirty search using |
Beta Was this translation helpful? Give feedback.
-
Initially attributes and a
KIM
syntax were proposed for data checks:There are two reasons for this. The primary reason was the concern that the
my TYPE VARLIST
syntax was already used and P5P might reject repurposing it. However, it now looks like this was worrying about nothing.The other reason was pushing Perl to standardize on
KIM
syntax, where appropriate. In particular, with a 36-year-old language, we're piling on syntax after syntax. The language is growing large and we wind up with bewildering "TATMWTDI" (There Are Too Many Ways To Do It) and every developer seems to fight for their one preferred way, meaning that new developers to Perl find a bewildering range of alternatives, some of which can have subtly different behaviors (for example,&foo($bar)
versusfoo($bar)
). Since theKIM
syntax is already used in Corinna, it seemed a logical thing to do.That being said, several people looking at the proposal were happy with attributes while others hated them.
Repurposing existing
my TYPE VARLIST
syntax has advantages:@druud @happy-barney @perigrin @rabbiveesh @rwp0 @SysPete @tobyink @demerphq
19 votes ·
Beta Was this translation helpful? Give feedback.
All reactions