1 |
On Wed, Nov 9, 2016 at 3:36 PM, Michał Górny <mgorny@g.o> wrote: |
2 |
> On Wed, 9 Nov 2016 14:32:33 +0800 |
3 |
> konsolebox <konsolebox@×××××.com> wrote: |
4 |
> |
5 |
>> On Tue, Nov 8, 2016 at 6:39 PM, Michał Górny <mgorny@g.o> wrote: |
6 |
>> >>dev-foo/bar{:1.3 :1.4 :1.5} ## Solves "A. Range dependencies vs |
7 |
>> >>slotting" |
8 |
>> > |
9 |
>> > I'm not sure about this. Slots are kinda special, especially with regard to slot operators. Problems I see: |
10 |
>> > |
11 |
>> > 1. := binds to slot of newest version matching the spec. How does this work with your spec? |
12 |
>> > |
13 |
>> > 2. Should we allow using := on some of the listed slots? What would happen? |
14 |
>> > |
15 |
>> > 3. It's asymmetric since we can't use an AND variant. |
16 |
>> |
17 |
>> I had to ask help from #gentoo-dev-help in order to properly |
18 |
>> understand slot operators since I haven't become too familiar with |
19 |
>> them so sorry for the late reply. (Thanks to desultory and _AxS_). |
20 |
>> |
21 |
>> Here I find it that we could just follow the simple AND/OR rule |
22 |
>> against every condition from left to right, and the interpreter would |
23 |
>> just do fine. A user may create insensible rules just like how one |
24 |
>> could create meaningless codes in C, but that won't stop the compiler |
25 |
>> from compiling the code, just like how this would not prevent the |
26 |
>> package manager from interpreting it. We're also free to detect |
27 |
>> ambiguous rules if we want to, and warn the user, or just disallow it |
28 |
>> completely. But it's still optional and wouldn't yield a difference |
29 |
>> to a stable operation. |
30 |
>> |
31 |
>> Examples: |
32 |
>> |
33 |
>> dev-foo/bar:={:1.3= :1.4= :1.5=} OR dev-foo/bar(:= {:1.3= :1.4= |
34 |
>> :1.5=}) renders := being an "any" operator meaningless since the |
35 |
>> condition requires {:1.3= :1.4= :1.5=} to also be true. It looks |
36 |
>> insensible, but it's still algorithmically correct, and can be |
37 |
>> interpreted by the package manager. |
38 |
> |
39 |
> Wrong. It means 'any OR 1.3 OR 1.4 ...'. Making 'any' no longer mean |
40 |
> 'any' in this context is confusing. |
41 |
|
42 |
Isn't that 'any AND (1.3 OR 1.4 OR 1.5)'? Would that make sense to |
43 |
have it the other way around instead? |
44 |
|
45 |
And when I wrote that, I already had the idea of AND being the default |
46 |
control operator, and spaces being optional. |
47 |
|
48 |
> What about {:1.3/2 :1.3/3 :1.3=}? |
49 |
|
50 |
Left to right. If :1.3/2 yields true, then the whole condition is |
51 |
valid, next is :1.3/3, then last :1.3=. If all is false, then the |
52 |
whole condition is false. |
53 |
|
54 |
>> dev-foo/bar(:* :=) renders :* meaningless since := restricts any |
55 |
>> installed runtime dependency's slot and subslot to be currently |
56 |
>> available. It's still algorithmically correct. |
57 |
> |
58 |
> 'any AND newest'? Why would you ever do that? The only purpose for :* |
59 |
> is to disable warnings on missing slot specifications when package has |
60 |
> multiple slots. |
61 |
|
62 |
I hope you're only arguing against the misuse, and not about whether |
63 |
it's feasible when it comes to the implementation. |
64 |
|
65 |
But anyway, "newest" is not what's being said in ebuild(5): |
66 |
|
67 |
":= Indicates that any slot value is acceptable. In addition, |
68 |
for runtime dependencies, indicates that the package will break unless |
69 |
a matching package with slot and sub-slot equal to the slot and |
70 |
sub-slot of the best installed version at the time the package was |
71 |
installed is available." |
72 |
|
73 |
It's all about whether the currently installed runtime dependency's |
74 |
current slot and sub-slot is available. := in this case is simply |
75 |
about checking that, and could only yield true or false. |
76 |
|
77 |
Like I said I'm still new when it comes to these operators, but kindly |
78 |
enlighten me so that we would know if := can be used as an independent |
79 |
conditional expression or not. |
80 |
|
81 |
Again, I don't agree with the misuse. I just intend to give an example. |
82 |
|
83 |
>> dev-foo/bar:={:1.3 :1.4 :1.5} OR dev-foo/bar(:= {:1.3 :1.4 :1.5}) |
84 |
>> implies that the currently installed package's slot and subslot should |
85 |
>> be available and that the version of the slot should be 1.3, 1.4, or |
86 |
>> 1.5. The interpreter could read that condition checking from left to |
87 |
>> right easily. Is the currently installed package's slot and subslot |
88 |
>> currently available? If no, this condition renders false and the |
89 |
>> currently installed package is invalid. If yes, we follow the next |
90 |
>> condition. Is the slot version any of 1.3, 1.4, or 1.5? If yes, then |
91 |
>> that condition yields true. |
92 |
> |
93 |
> I see a lot of added complexity here, for no benefit whatsoever. |
94 |
|
95 |
No, it's not complex at all as everything would just be packaged in |
96 |
one logical code. I just had to explain detail by detail so I could |
97 |
prove that it's doable. |
98 |
|
99 |
The current check-if-some-specific-element-comes-before-or-after-another |
100 |
which propagates everywhere in every context of every different type |
101 |
of conditional element being checked makes things more complex. |
102 |
|
103 |
>> > 4. Do we allow different ranges per slots? |
104 |
>> |
105 |
>> Seems possible like {:>=1.3 :<=1.5}. Comparing subslots is also just |
106 |
>> about grouping where in x/y, x is the major and y is the minor. Major |
107 |
>> versions are compared first, and minor versions are only compared if |
108 |
>> major versions are equal. |
109 |
> |
110 |
> Slots are not numbers nor versions. You can't compare them. |
111 |
|
112 |
Not that I really care about ranges for slots, but can you explain |
113 |
why? Is that somehow dependent to a current implementation? |
114 |
|
115 |
>> > How do we combine various order of data? |
116 |
>> |
117 |
>> I need specific example/detail on that, or perhaps I already have that |
118 |
>> answered above. |
119 |
> |
120 |
> dev-foo/bar(:1.6 {>=3.4 :5[foo]} ([bar] <3.7)) |
121 |
|
122 |
I'm yet to add opinion on allowing use flags to be used anywhere |
123 |
besides outside a group and only once. But that looks doable, |
124 |
although seems more complicated to implement, or at least heavier, |
125 |
maybe. You should also correct that a bit: |
126 |
|
127 |
dev-foo/bar(:1.6 {>=3.4 (:5 [foo])} ([bar] <3.7)) |
128 |
|
129 |
Also, enclosing [bar] and <3.7 inside () may not be necessary, unless |
130 |
you'd want <3.7 to only compare against dev-foo/bar[bar] where you'll |
131 |
have to use {![bar] <3.7}, or introduce a ternary operator like '[bar] |
132 |
? <3.7 : true', which I think is not yet a necessary feature to |
133 |
include. |
134 |
|
135 |
>> >>Along with it, we should also drop the strict order of the slot, |
136 |
>> >>version, and repo expressions (just change it to "recommended"). It |
137 |
>> >>makes things more flexible and makes it easier for the parser to be |
138 |
>> >>implemented. |
139 |
>> > |
140 |
>> > Problems: |
141 |
>> > |
142 |
>> > 1. This could result in fairly ambiguous variants with some syntaxes purposes. |
143 |
>> |
144 |
>> I think that would only apply to older versions of Portage that would |
145 |
>> not recognize loose arrangement of conditions. Can you give a |
146 |
>> specific variant where would this become an issue? |
147 |
> |
148 |
> dev-foo/bar:1===3 |
149 |
|
150 |
Ok, just like everyone has already suggested grouping may be necessary. |
151 |
|
152 |
dev-foo/bar:1=(==3) |
153 |
|
154 |
>> > 2. This makes 'simple validation' harder. Strict order makes it possible to write a simple regular expression that validates that are elements are in place and correct, and are not repeated. |
155 |
>> |
156 |
>> It's quite the opposite. |
157 |
>> |
158 |
>> Before that 'simple validation', parsing would come first (unless |
159 |
>> parsing comes along with (the only) validation itself), and parsing |
160 |
>> itself [with/without the validation] has already become difficult due |
161 |
>> to many conditions that one should come or could come before/after |
162 |
>> another. If every condition would just be elements with different |
163 |
>> classes, it would be easier to do a validation. You'll just need a |
164 |
>> single loop with case statements for that, rather than have a tree of |
165 |
>> if conditions. |
166 |
>> |
167 |
>> If there's another validation stage that's necessary to do after |
168 |
>> parsing, the same holds true for it: just one single loop, and no |
169 |
>> check if an element follows one after another. Checking whether stuff |
170 |
>> are repeated is still doable (if it still becomes necessary). |
171 |
>> |
172 |
>> I also hope you're not after grep-ability. If not, just ignore this. |
173 |
>> Grep/regex scanning itself is slow, and is a bit of a hack to me, |
174 |
>> especially if it's used in parsing. Not that I'm saying it's a bad |
175 |
>> solution for doing validations, but it shouldn't be something to rely |
176 |
>> upon when judging this. |
177 |
> |
178 |
> Yes, I am. In some cases, regexp is the only thing you have |
179 |
> (e.g. in XSD). The major problem with current syntax is that you can't |
180 |
> properly validate restrict="" in XSD because you'd have to |
181 |
> backreference operator. |
182 |
|
183 |
I don't know XSD, but it's good if we can improve it as well so we can innovate. |
184 |
|
185 |
>> > 3. Do we allow multiple occurrences of the same type of element? I'm specifically thinking of multiple disjoint USE dependency blocks. |
186 |
>> |
187 |
>> I'm sorry but I'm not sure what you mean there. I hope you can give an example. |
188 |
> |
189 |
> dev-foo/bar[foo][bar] |
190 |
|
191 |
Again, I never really thought about allowing the [use] block to be |
192 |
more re-arrangeable in the sense that it can be used more than once |
193 |
and that it can be allowed inside condition blocks, but so far it |
194 |
really looks doable, and we could drop the restrictions. This would |
195 |
be possible along with having everything changed to independent |
196 |
conditional elements. |
197 |
|
198 |
-- |
199 |
konsolebox |