[Pharo-project] [ENH] Literal Byte Arrays
I committed a patch that adds literal byte arrays to Pharo, with the same syntax as most other Smalltalk do (VW, VASt, GST). http://code.google.com/p/pharo/issues/detail?id=468 I would appreciate if somebody could review the change, as it would be very useful for Seaside and solves reoccurring headaches. In my image I have almost 50 places where even the Pharo base code could profit from this extension, these places can be identified using the search expression: `#literal asByteArray I can provide a refactoring at a later point, if desired. The change is simple and loads through Monticello, even if this is modifying the scanner on the fly. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch
Lukas so do I understand correctly that your point is to replace asByteArray by #[] Stef On Jan 30, 2009, at 8:47 AM, Lukas Renggli wrote:
I committed a patch that adds literal byte arrays to Pharo, with the same syntax as most other Smalltalk do (VW, VASt, GST).
http://code.google.com/p/pharo/issues/detail?id=468
I would appreciate if somebody could review the change, as it would be very useful for Seaside and solves reoccurring headaches. In my image I have almost 50 places where even the Pharo base code could profit from this extension, these places can be identified using the search expression:
`#literal asByteArray
I can provide a refactoring at a later point, if desired.
The change is simple and loads through Monticello, even if this is modifying the scanner on the fly.
Cheers, Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
so do I understand correctly that your point is to replace asByteArray by #[]
Yes, instead of writing #( 1 2 3 ) asByteArray you write #[ 1 2 3 ] Which is much faster and saves memory, as no conversion and no copying happens at runtime. All Smalltalk dialects (with the exception of GemStone) support this syntax. Pharo should have it too. Lukas -- Lukas Renggli http://www.lukas-renggli.ch
Maybe this is something the compiler could do without extending the syntax since, I far as I understood, "#(...) asByteArray" is always equivalent to"#[...]" Statically, the compiler could make the conversion. No? Alexandre On 30 Jan 2009, at 10:55, Lukas Renggli wrote:
so do I understand correctly that your point is to replace asByteArray by #[]
Yes, instead of writing
#( 1 2 3 ) asByteArray
you write
#[ 1 2 3 ]
Which is much faster and saves memory, as no conversion and no copying happens at runtime. All Smalltalk dialects (with the exception of GemStone) support this syntax. Pharo should have it too.
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Statically, the compiler could make the conversion. No?
Sure, that would be a possibility, but it is not standard. Almost all modern Smalltalk implementations support the #[ ] syntax. The parsers of the NewCompiler and the RefactoringBrowser already support the syntax for literal byte arrays for decades. Why the resistance? Lukas -- Lukas Renggli http://www.lukas-renggli.ch
I went through your change. Very small change, lean, and well tested. Cheers, Alexandre On 30 Jan 2009, at 08:47, Lukas Renggli wrote:
I committed a patch that adds literal byte arrays to Pharo, with the same syntax as most other Smalltalk do (VW, VASt, GST).
http://code.google.com/p/pharo/issues/detail?id=468
I would appreciate if somebody could review the change, as it would be very useful for Seaside and solves reoccurring headaches. In my image I have almost 50 places where even the Pharo base code could profit from this extension, these places can be identified using the search expression:
`#literal asByteArray
I can provide a refactoring at a later point, if desired.
The change is simple and loads through Monticello, even if this is modifying the scanner on the fly.
Cheers, Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
Lukas I will harvest it today. stef On Jan 30, 2009, at 3:37 PM, Lukas Renggli wrote:
Statically, the compiler could make the conversion. No?
Sure, that would be a possibility, but it is not standard.
Almost all modern Smalltalk implementations support the #[ ] syntax. The parsers of the NewCompiler and the RefactoringBrowser already support the syntax for literal byte arrays for decades. Why the resistance?
Lukas
-- Lukas Renggli http://www.lukas-renggli.ch
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (3)
-
Alexandre Bergel -
Lukas Renggli -
Stéphane Ducasse