I have few experience with languages like Python, Perl and Ruby, but I have developed in Smalltalk from some time. There are some pretty basic Smalltalk classes which are very popular and cross-Smalltalk implementation:
FileStream
ReadWriteStream
Set
Dictionary
OrderedCollection
SortedCollection
Bag
Interval
Array
Which classes would be the equivalent or valid semantic replacements in Python, Perl and Ruby? I've found several language comparison pages comparing syntax, however it seems there is little help when comes to the translation of core and base libraries.
I also wonder if there is a base or core class in Python, Perl or Ruby which is not present in Smalltalk or viceversa?
I'll answer for Perl, since I'm fluent in both Perl and Smalltalk.
Smalltalk's Dictionary is fairly close to Perl's hash type. A Dictionary uses object equivalence for the keys. Perl uses simple strings for keys, so the flexibility is somewhat limited.
Smalltalk's OrderedCollection is fairly close to Perl's array type.
Smalltalk's FileStream is somewhat like Perl's filehandles, in the sense that they represent a stream of data to an external file or device.
And that's about it, since Perl has only hashes and arrays and filehandles. :)
FileStream -> File
ReadWriteStream -> IO (or other things that duck type like it)
Set -> require 'set', then use the Set class
Dictionary -> Hash
OrderedCollection -> Array
SortedCollection nothing similar
Bag nothing similar
Interval -> Range
Array Ruby has no fixed-length collection class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With