These tables are comprehensive, but the authors don't seem to actually understand the languages' idioms. Over on the ISWIM-family page the Haskell "command line args" program is ten lines long, when it could be: import System main = getArgs >>= mapM_ putStrLn I wish these were written by people who knew the languages.
You can't create 'idiomatic polyglots'. You just hack things together until they sorta work, for more than few languages this basically involves large strings and lots of backslashes, or base64 or something like that. (Writing a polyglot that does something more clever is obviously much better style, but it's incredibly hard.)
Hyperpolyglot: PHP, Perl, Python, Ruby
21–30 of 58 posts
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#22Earlier quoted context omitted.
You can't create 'idiomatic polyglots'. You just hack things together until they sorta work, for more than few languages this basically involves large strings and lots of backslashes, or base64 or something like that. (Writing a polyglot that does something more clever is obviously much better style, but it's incredibly hard.)
"Polyglot" in this case is referring to a person who can write in multiple languages, not a program written in multiple languages.
I assumed it was for people writing "polyglot" toy programs, because it'd be very useful resource.
I very rarely encounter uses of the term "polyglot" referring to people knowing large number of programming languages, so I didn't think of this use. Looking at it now, from this perspective, I have to say that I don't think it would be useful for these people, not enough depth.
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#23Earlier quoted context omitted.
You can't create 'idiomatic polyglots'. You just hack things together until they sorta work, for more than few languages this basically involves large strings and lots of backslashes, or base64 or something like that. (Writing a polyglot that does something more clever is obviously much better style, but it's incredibly hard.)
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.
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
#24These tables are comprehensive, but the authors don't seem to actually understand the languages' idioms. Over on the ISWIM-family page the Haskell "command line args" program is ten lines long, when it could be: import System main = getArgs >>= mapM_ putStrLn I wish these were written by people who knew the languages.
(There's at least couple more errors on the Haskell column, a typo, and a missing idiom for their 'each' example, which would be 'mapM_ print', basically).
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#25Earlier quoted context omitted.
"Polyglot" in this case is referring to a person who can write in multiple languages, not a program written in multiple languages.
The site doesn't mention which meaning of "polyglot" the people behind it had in mind. I assumed it was for people writing "polyglot" toy programs, because it'd be very useful resource. I very rarely encounter uses of the term "polyglot" referring to people knowing large number of programming languages, so I didn't think of this use. Looking at it now, from this perspective, I have to say that I don't think it would…
It isn't so in this case, as the code for each language is clearly different. It's more of a 'construct translator' kind of thing.
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#26That these languages are so similar a table like this is possible leads one to think those programmers who consider themselves "polyglot" by programming in a subset of these aren't really "polyglot" at all.
Go to http://hyperpolyglot.org/ directly. Included there: Scripting Languages: PHP, Perl, Python, Ruby Embeddable Languages: Tcl, Lua, JavaScript, Io Shell Languages: Bash, Zsh, AppleScript, PowerShell C Style Languages: C, C++, Objective C, Java, C# Pascal Style Languages: Pascal, Ada, PL/SQL, SQL/PSM Lisp Dialects: Common Lisp, Scheme, Clojure, Emacs Lisp Type Inference Languages: Standard ML, OCaml, Scala, Haskell…
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#27x.succ is not the Ruby equivalent of ++$x in PHP (or Perl). x.succ returns x + 1 (by default, on integers) but does not increment x as ++$x does (since numbers are immutable and that's what "x" is giving us in Ruby). The closest match would be x += 1 (shorthand for x = x + 1). I don't see x = x.succ in common usage but that would work too.
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#28Earlier quoted context omitted.
The site doesn't mention which meaning of "polyglot" the people behind it had in mind. I assumed it was for people writing "polyglot" toy programs, because it'd be very useful resource. I very rarely encounter uses of the term "polyglot" referring to people knowing large number of programming languages, so I didn't think of this use. Looking at it now, from this perspective, I have to say that I don't think it would…
> I assumed it was for people writing "polyglot" toy programs, because it'd be very useful resource. It isn't so in this case, as the code for each language is clearly different. It's more of a 'construct translator' kind of thing.
It's always the case. That's why writing them is interesting.
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#29x.succ is not the Ruby equivalent of ++$x in PHP (or Perl). x.succ returns x + 1 (by default, on integers) but does not increment x as ++$x does (since numbers are immutable and that's what "x" is giving us in Ruby). The closest match would be x += 1 (shorthand for x = x + 1). I don't see x = x.succ in common usage but that would work too.
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 increment an integer.
Re: Hyperpolyglot: PHP, Perl, Python, Ruby
#30x.succ is not the Ruby equivalent of ++$x in PHP (or Perl). x.succ returns x + 1 (by default, on integers) but does not increment x as ++$x does (since numbers are immutable and that's what "x" is giving us in Ruby). The closest match would be x += 1 (shorthand for x = x + 1). I don't see x = x.succ in common usage but that would work too.
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…