Earlier quoted context omitted.
Smalltalk definitely belongs on the list, it's the only one that takes "object-oriented" to its logical conclusion (dispatch can replace control structures). I'd suggest omitting Elisp and ObjC—they're both lackluster imitations of better languages that will do far more for the way you think, unless you happen to be developing for their captive platform (Emacs and iOS, respectively).
> Smalltalk definitely belongs on the list, it's the only one that takes "object-oriented" to its logical conclusion (dispatch can replace control structures). i believe io does this as well.
Hyperpolyglot: PHP, Perl, Python, Ruby
51–58 of 58 posts
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#52Earlier quoted context omitted.
Different definitions. You seem to be thinking of programs that are valid in multiple languages. The page is more of a dictionary of language constructs.
> The page is more of a dictionary of language constructs. Which would come incredibly useful if you wanted to write a polyglot program. Why else would you use a reference like this? If you wanted to learn a language, or had to hack something in a language you don't know, you'll be better off using resources specific to given language(s).
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#53Earlier quoted context omitted.
> Smalltalk definitely belongs on the list, it's the only one that takes "object-oriented" to its logical conclusion (dispatch can replace control structures). i believe io does this as well.
Unless I misunderstand what you mean, don't a host of languages do this? io, ruby, javascript?
# Ruby
if someThing()
doThis()
else
doThisInstead()
end
# Javascript/Perl/etc
if (someThing()) { doThis() }
else { doThisInstead() }
Whereas Io & Smalltalk requires no new syntax and uses objects & messages: # Io
if(someThing, doThis, doThisInstead)
# Io like Ruby,etc
if(something) then(doThis) else(doThisInstead)
# Io like Smalltalk
someThing ifTrue(doThis) ifFalse(doThisInstead)
# Smaltalk
someThing ifTrue: [doThis] ifFalse: [doThisInstead].Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#54Earlier quoted context omitted.
I would have liked for Go to have been included, (C style languages) not to mention Smalltalk.
Smalltalk definitely belongs on the list, it's the only one that takes "object-oriented" to its logical conclusion (dispatch can replace control structures). I'd suggest omitting Elisp and ObjC—they're both lackluster imitations of better languages that will do far more for the way you think, unless you happen to be developing for their captive platform (Emacs and iOS, respectively).
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#55Earlier quoted context omitted.
Yes, but functionally the Ruby example is the equivalent of a public member variable. Since those are public by default in PHP, there is no need to complicate the code by first making it private and then implementing a getter and a setter.
This is a kind of a semantic game. You might say they're "equivalent," but you're still doing different things — and different is very rarely truly equal. For example, the Ruby accessors could be hooked or altered later without changing the interface. Not so if you use a public variable (which Ruby doesn't have, for this very reason). The only language I know of where public variables and accessors are truly intercha…
class Int(object):
def __init__(self, value):
self.value = value
@property
def value(self):
print("Accessing value")
return self.value
@value.setter
def value(self, value):
print("Setting value")
self.value = valueRe: Hyperpolyglot: PHP, Perl, Python, Ruby
#56Earlier quoted context omitted.
Unless I misunderstand what you mean, don't a host of languages do this? io, ruby, javascript?
Ruby & Javascript have syntax defined in their parsers for control structures. for eg: # Ruby if someThing() doThis() else doThisInstead() end # Javascript/Perl/etc if (someThing()) { doThis() } else { doThisInstead() } Whereas Io & Smalltalk requires no new syntax and uses objects & messages: # Io if(someThing, doThis, doThisInstead) # Io like Ruby,etc if(something) then(doThis) else(doThisInstead) # Io like Smallta…
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#57Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#58Earlier quoted context omitted.
Yeah, #succ is something else. For example, if your object supports #succ then you can use it in ranges. e.g., (1..10), but also ("apple".."kiwis") or ('A'..'Z'). In this case, String#succ returns a string with the last alphanumeric character transformed into its successor, e.g., "apple".succ == "applef". The only time I've used it is implementing the range interface; I've never called it directly, let alone to incre…
I assume you mean "apple".succ == "applf" ?