develooper Front page | perl.perl6.users | Postings from June 2020

Re: I reproduced one of the errors!

Thread Previous | Thread Next
Peter Pentchev
June 1, 2020 00:12
Re: I reproduced one of the errors!
Message ID:
On Sun, May 31, 2020 at 04:29:55PM -0700, ToddAndMargo via perl6-users wrote:
> On 2020-05-31 04:58, Peter Pentchev wrote:
> > > > So my beef is when you feed these guys an undefined
> > > > variable, that they needs to tell you it requires
> > > > a "defined" variable.  Not a bunch of useless rubbish.
> > > > For example (useless rubbish):
> > And also... I thought I mentioned this before. You want a more clear
> > error message for*one*  *single*  specific case of a "can't find this
> > method, did you mean one of these?" error message. I tried to explain
> > that this error message is one that is displayed in many cases, not only
> > for "you passed an undefined thing, I want a defined thing"; in my
> > opinion, it is actually quite helpful in that it actually lists
> > the candidates in a "did you mean one of these?" style.
> > 
> > You want it to be clear if you pass an undefined value where a defined
> > value was expected; that would mean that somebody would have to write
> > the code to make it check whether it is this very specific case and then
> > that code would have to be maintained for years and years. Tomorrow
> > you'll say "but can't it give me a more clear message when I pass an
> > integer and it expected a string?" and the day after tomorrow you'll say
> > "but can't it give me a more clear message when I pass a string and it
> > expected a function?".
> > 
> > The error message says "you passed an object of this type, and I can't
> > find this method for this type; here are a couple of types that have
> > this method, did you mean one of these?"  It tells you what the types
> > are, and it doesn't have to have thousands of special cases. It tells
> > you what the types are.
> Hi Peter,
> I like that you in-line and bottom post.  You are a lot
> easier to follow.
> I think are talking at cross purposes.  Let me give an
> example:
> Q: is a "cow" a "Plant"?
> A: a "cow" in not a hazel nut
> A: a "cow" in not a radish
> A: a "cow" in not a carrot
> A: a "cow" in not a cabbage
> ...
> Are all of the answers a correct?
> Yes.. Evey answer is completely correct.
> Are any of the answers helpful?
> No

Right. So, once again, just as I said, you are only interested in one of
the answers - "Str:U is not a Str:D, you want a Str:D". However, how
should Raku know *which* one of the answers you are interested in?
Tomorrow you may pass an integer to a function that only accepts strings
and floating-point numbers; should Raku tell you "you must pass a
string, not an integer" or "you must pass a floating-point number, not
an integer"? Raku doesn't know which one of those you meant.


Peter Pentchev
PGP key:
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About