|Anonymous | Login||08-17-2019 17:35 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details [ Jump to Notes ]||[ View Advanced ] [ Issue History ] [ Print ]|
|ID||Category||Severity||Reproducibility||Date Submitted||Last Update|
|0003484||[Squeak] Kernel||minor||always||04-19-06 21:56||04-22-06 13:40|
|Summary||0003484: Error in BlockContext>>valueWithArguments:|
From: Dave Mason
Subject: Error in BlockContext>>valueWithArguments:
Date: 16. April 2006 00:22:54 GMT+02:00
This in Squeak3.8-6665.
BlockContext>>valueWithArguments gives a very misleading error.
Basically the 'already being evaluated' case is the fallback, but if you
have a non-array anArray parameter, the primitive fails and you get that
fallback error. I just added a test for that case.
(I was playing with continuations, so 'already being evaluated' *was* a
possibility, which made it extra-challenging to track down.)
"Primitive. Evaluate the block represented by the receiver. The argument
is an Array whose elements are the arguments for the block. Fail if the
length of the Array is not the same as the the number of arguments that
the block was expecting. Fail if the block is already being executed.
Essential. See Object documentation whatIsAPrimitive."
self numArgs = anArray size
ifTrue: [(anArray isKindOf: Array)
ifTrue:[self error: 'Attempt to evaluate a block that is already being evaluated.']
ifFalse:[self error: 'parameter is not an Array']]
ifFalse: [self error:
'This block accepts ' ,self numArgs printString, ' argument', (self numArgs = 1 ifTrue:[''] ifFalse:['s']) ,
', but was called with ', anArray size printString, '.']
|Attached Files||BlockContext-valueWithArguments.st [^] (1,005 bytes) 04-21-06 19:34|
(0004766 - 681 - 749 - 749 - 749 - 749 - 749)
So, mantis throws away a note when you upload a file ... hmm.
What I had written was:
The problem with Dave's fix is that IF "anArray" is NOT an array, then size might not be understood. Well, OK, object undersatnds size, but will generat the object not indexable error.
So, the kindOf: test should come first. Followed by the size test. For readability, I would put the "already being evaluated" error at the end, after the more specific things have been tested for. Fileout attached.
I normally hate kindOf: tests, but in this case it is exactly the right thing, because the VM primitive does in fact require an Array; an orderedCollection, for example, won't do.
(0004773 - 48 - 54 - 54 - 54 - 54 - 54)
is it the same in 3.9?
What is then the status?
|04-19-06 21:56||MarcusDenker||New Issue|
|04-21-06 19:34||black||File Added: BlockContext-valueWithArguments.st|
|04-21-06 19:37||black||Note Added: 0004766|
|04-22-06 13:40||ducasse||Note Added: 0004773|
| Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
39 total queries executed.|
30 unique queries executed.