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

value bug with wildcard? #421

Open
ramagottfried opened this issue Apr 29, 2021 · 8 comments
Open

value bug with wildcard? #421

ramagottfried opened this issue Apr 29, 2021 · 8 comments

Comments

@ramagottfried
Copy link
Member

ramagottfried commented Apr 29, 2021

not sure what's going on here exactly -- any ideas? is it a bug? I think it might be.


----------begin_max5_patcher----------
1028.3oc6X0zaaiCD8r8uBAdpovqiHE0GbA5g8xdt2qKLnkncUWYJAJJutMH
+26PRIaoX65jTErMXCPhr3vY37Fx2Lbrua5Dzpx8hZj2e58IuISta5jIVQFA
SZGOAskuOsfWaUCUNOsbaUYs.MyMqVrWam412COuagzy610kkv63Ex6msPda
FWyOyTcKPQtTjV1HsqRTqvJknVH0bcdob4Y0nrQWHz5uUIbvGg79b6Txls4R
XRKhIsBWWJ0q4oVs867BWm9kb4lkJQp1sLwwQyYAggznj3vYdIAwy8m4giYl
ORfA88hCCV2faklm41lV80+fD2Eh07chrkqZjYEhkEB4F8Wr1PnmSAy9kCLA
.BXIf6wwlGFf3aeXj4imAAx0+iBJSA6ojCRnv+QmnX.HZT7HNx4QrOwrH31G
C.E0Lc3ol168PR2x.CXV7D4dw+0Pj38YyY68SmZdL6kI85r4PAWMGJ3kMGJA
ylSOlCEw5mCQYOobH1UxghRdKEZbHdh8UJf8kILJdB6yVD+Cd63EMh2s.XiK
P2ftDM5uaJJ9HO8eDZzrAiNO8B+KQuhihmCePnDC8J.eQ5E4T5UfOZbSRwuZ
RRiHgCRRSXO+jzneqRRY+e71A7EZ9pQU.ifDV7BzSsYr3qxQieY4nAQrAMiQ
5yQgCrmDIM7ZciQouwRub2XGVFGVnsv3jkAeXYFFlu0V2q815nXxnciQvas0
8aQaclqG9f2FglmkA7pZQ86t4v0Dcs6Yz5lyxIIWkSR9uoGwGvUiCY85QjRe
J8HRH86QzZmcS3A+rIVPXjO7zntrQk1EyceiFuitOSTqyk1MtdJA8kZU5rm3
OVO0sH+TOY9QJtH25QGSQOFOQFgXpaQ94dJbLhofmWL4HH7ppcBUcq1Vm.Il
esTYFZqsg.xsankygThc4c5aI1HtBX0ZfR2nr.CsOhhblBoyJYStMwXpI7.W
Vq+VwCIkR9VmoqJfjKuRo2+ZVRWtLpYqP1LbaX0l04EEokENnM4vLPQi1bWj
a1YshsivN25OOIhDSMEulmD6Glj3dKgFXJ0cLqq0LRmYDlOlYp6NOvmk3Scu
AhNqYNqv1ae5+3nZb4lBKXIwPShcRqTkUkptiPvCrC52nK2n3Y4BWUKeqb69
ZW8RqmWlKMGqhC3NfQvVbSBoLSQc3s9g6ziKioRyJgZ39sobV2gDvo9KUNu3
XEvmue6UsrN+6s1A0De.jp3JHhsLG6QaKwXaSgNuaenexyA9TJuxrO5YuIwY
TlXMGr6z3qqb8m7HWBX3QCX0P9hAXY46xgjj5qAtKu4OD5AWB5giNzykqK8T
hM+ZP+E4XWmqM0XFo8T7E.Lw+4AXWoWayOFHTW05IaORSue5O.rovElA
-----------end_max5_patcher-----------
@ramagottfried
Copy link
Member Author

(I just edited the example slightly to make it clearer)

@ramagottfried
Copy link
Member Author

ah! the plot thickens: /* is a bundle, but /1 is a string


----------begin_max5_patcher----------
887.3oc2V0zaaiCD8r8uBAdIsEtNhTeXoBjC6kdt2qKLnkncYWYRARprNaP9
uuyPJ4XmXi3j3Br6BXSINbFNONyaFp6GOhrTuUXIQeI56QiFc+3Qi7hPAi5m
Ohrguspga8pQzSqk11F9cjIgUchsN+JWSgw6mqhhtdkVCuSmqdXxb00clFX1
bPg4Dbt6tVAH3J6UC6QiTIpzcJ+Fk0KT24ZDNT4.9HjnezujpaiTAK5gDsW3
JsxshW40NtWVK2U8SoZ8BinxE1lTJaZZRVVZdwrrIQErjowShnYw3ihrow66
k.FNvMx5PbX4u9bRFAk8v3w3vjyNBVo2zpshyKBdzXTxv4yHrBki6jZ0hipw
4FEYutnXFkNEhd4Ek9v1LbLs70D7X4CmLK+VQ8hkcp5FwhFgZs6mnV4EGa8Z
tiGfPB3+xBH0QmgCXRL1OfxhoS.3+x+RAkSmgXemjT3e9yTLADcQ7HMO3QZL
C2DZ+vAfJEWN64lF8iKKe6S+mgu8jp12CuK4eU7N1+i4chssFf7UKPEeF4Cu
V3ln0BGutFnUVg8Ceb20C2DgOb701OfJ9wixJYuHqjcJV4W6ZZ9Fu5OENxjC
l863NlYYkXyRZVtmtldR5J6HzU192w3syGDdxk1dPfxOLgX0clpgyb+1Aozc
tuVXcRkOvsmRv8ZdkNZR+r8T9Y3oA3797TxaySgfIus8Vgw1qs2I.O9WZCN0
2Jf.DgvTe9gXD2JGz2SBHbCv.bP5uy3AFYadJIXJv9MpNomDMFOdfKst6ZdZ
BTw2DLcYCPDizpn+B2x.umzsQn5NLLrb8JYSSktI.sQ6VApw544jvpS5E6mQ
CtMdZQNaVJVqOsXVbVQQ3shzDryviLzdyXClwJiokXapoIwkEwog2.QG0rfU
T+WXs+vipwUqa7fkMC+BrdosFcq1LjBAOTtS+NmdsgWKEgJ7Xubebcn8h2yK
jJLsJ1g6jRF0iaVVZI1CDda+i63G2FrpbovbX7FK8GRR.m5OLRdyicKd69cu
NKV4e2aGz+3IPpkafSrm43Ss8DiMcMN4PbX+hmc7oJdKFGi7MdCFUKVwA6d9
4an012iXmBXzKFvrP8BBrZ4sRnHw9Rf6zA+Cgdxofd1EG5R0JcjQr98A8eKo
cmzg8XtPwT5I.LK9sA3PqW+2JfPv116I+mTL9gw+Cj80WUK
-----------end_max5_patcher-----------

@maccallum
Copy link
Member

Ok, so this is extremely confusing, but not a bug. The input bundle is

/* : { /foo : 1}

and the program is

/url = getaddresses(),
/data = value(/url)

The first line of the program produces a binding of /url = "/*", so now the working bundle is

/* : { /foo : 1},
/url = "/*"

Then, when value(/url) is evaluated in the second line, the address (string) /url is compared to the pattern in the first message of the working bundle, which is /*, which produces a match, resulting in value( { /foo : 1 } ), which the value function just bails on.

There is a bug here--it's that value doesn't report an error. But in terms of pattern matching, it's unfortunately doing the right thing, even if it's confusing

@ramagottfried
Copy link
Member Author

why does value do pattern matching with the wild card? I think only match should do pattern matching, otherwise this means you can't operate on wildcard addresses, which would be unfortunate.

@ramagottfried
Copy link
Member Author

did you see the second issue?

<pre><code>
----------begin_max5_patcher----------
843.3oc2VszaaDBD9r8uBzdJox0YW12UpG5kdt2Sphv6hcHECq.1TmFk+6kA
Xsie07xpRsRV3kgY36aF9F18gwihlIWQ0QnOgtDMZzCiGMxYBLLJLeTzRxpF
NQ6bKRNsko63j6il3WsiXZtgIVbsh1X76TU7zrz77rhpx7InhX7z3Inj7X3u
zzownuGhctTXlSZnPXwAah9kLAmZbvkDLxZ8fO61OllGswSYuYWW8lL22Q8j
IJB8cXkGGOFFl7hyyF4xNolNflgtxkdQWjXGe3JABcwboDP9JwiCdwYBZirW
3bM83knjx5o1ZisDAEkpRXLq90TZv6WZvEu9RSXIM4NZ60y5Esb50bpXg4Fv
mhpCsdKwP76PpMGpqrGtIkv.bLG6F.awISrT+4+kYcNqDx+0VxfRydNlZMcR
PLoviXRLF1jjvvVjJCVNe+PO0poObBTSa2vchEUo+aKpv+GKpnq5TVkUKEbb
OkUuhi9LZA0PZaUTslpO67IWIt.NqrK.+YHKzmANd9Akb3WpjKOsBtNKIuvo
4xdm2wiwGVygOll6q8b92HM+fZhlr0rsJrNN4xvcdkmK+.6aWs0xdUy.DC8B
nMoVKUaXBhgIEO0Ir2oCdh9hQp3uFR3W.RvKc2AIewjz0cGUoCd6.wJRuUpf
ot97H6Qsep6zKRQuiM3uSODQTVwkwpr5UNhEspHKxGpUZqD8LmLYLjdVH0l6
46d.JHK8gNiaO2QRA5mvV5UQfHZFUscc.jkCQYSxunXD9latflnFIWptlIf7
K3V7TbZMFZzsOkmUCc51mJqxRg18cT8Z1uBwkfmtt34oT+RpneaF8twb1h4L
N2sEgcNr018NzpD4WcRvraVx.NUE3xL3xooUkw4UU9m1CmPX30zqNNo1Quz3
5p3L+SVSGLrPAw8EgOcXiaDwBtir3R3KFCV6TxNoZPVZQnds+8F4BEokQ8WZ
E6r6ToqK2cDkcUmxwUFBBik8bCaHlm17rVO0P5.LQtaU8A0RmSrwsubZ3VtK
Q3ioCR1UG7lIl11u.DqkcGy1jneNxcbs91TO8XTO+jSclXtDonKdeT+O0k8l
ongYf6XNQ0zjiPXb7aiv9qdceH.PAcW.I22KL9ww+FfRI.B3
-----------end_max5_patcher-----------
</code></pre>

@ramagottfried
Copy link
Member Author

or is that similar, that typetags also does pattern matching? wow,... still really not sure that o.expr should do pattern matching without calling match

@maccallum
Copy link
Member

@ramagottfried, I think you're right that pattern matching in o.expr should be explicit, rather than implicit. I just checked the history, and this behavior has been there forever, so this would be a breaking change, although, I'm not sure anyone relies on it. I'm going to add this to the 1.4 list--I think it's too late to consider something as deep as this for 1.3.

@ramagottfried
Copy link
Member Author

@maccallum cool, that sounds good -- I'm fairly sure that not many people are using the hidden pattern matching functionality, since as far as I know there is no example of this in the documentation, I only stumbled on it when trying to operate on a wildcard address (that was then being sent to another process where the matching happens).

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