[squeak-dev] CompiledCode(SequenceableCollection)>>#flatten

christoph.thiede at student.hpi.uni-potsdam.de christoph.thiede at student.hpi.uni-potsdam.de
Thu Dec 30 12:22:43 UTC 2021


Hi all,

this fails:

	{Object >> #halt} flatten.

	CompiledMethod(Object)>>error:
		Receiver: (Object>>#halt "a CompiledMethod(343681)")
		Arguments and temporary variables: 
			aString: 	'subscript is out of bounds: 1'
		Receiver's instance variables: 
	(Object>>#halt "a CompiledMethod(343681)")

	CompiledMethod(Object)>>errorSubscriptBounds:
		Receiver: (Object>>#halt "a CompiledMethod(343681)")
		Arguments and temporary variables: 
			index: 	1
		Receiver's instance variables: 
	(Object>>#halt "a CompiledMethod(343681)")

	CompiledMethod(Object)>>at:
		Receiver: (Object>>#halt "a CompiledMethod(343681)")
		Arguments and temporary variables: 
			index: 	1
		Receiver's instance variables: 
	(Object>>#halt "a CompiledMethod(343681)")

	CompiledMethod(SequenceableCollection)>>do:
		Receiver: (Object>>#halt "a CompiledMethod(343681)")
		Arguments and temporary variables: 
			aBlock: 	[closure] in [] in CompiledMethod(SequenceableCollection)>>flatten
			index: 	1
			indexLimiT: 	48
		Receiver's instance variables: 
	(Object>>#halt "a CompiledMethod(343681)")

	[] in CompiledMethod(SequenceableCollection)>>flatten
		Receiver: (Object>>#halt "a CompiledMethod(343681)")
		Arguments and temporary variables: 
			stream: 	a WriteStream
		Receiver's instance variables: 
	(Object>>#halt "a CompiledMethod(343681)")

You get the problem, we don't want to split up compiled codes. How should we fix it? Replace each isString with something like each canBeFlattened? Or just override #flatten on String and CompiledCode instead?

By the way, I am also not sure whether this is what we expect:

	{'foo'. 'bar' asText. UUID new} flatten. "#('foo' $b $a $r 188 125 70 227 253 103 13 67 180 100 32 52 18 134 92 153)"

Maybe also override #flatten on Text and UUID? Any other collections that we do not want to flatten? It is hard to make this decision without knowledge about the domain-specific context ... :-)

Best,
Christoph

---
Sent from Squeak Inbox Talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211230/7c18c749/attachment.html>


More information about the Squeak-dev mailing list