Talk:Polyglot (computing)

Latest comment: 1 year ago by Barnards.tar.gz in topic Merge with Polyglot markup, and extend

Untitled

edit

This polyglot doesn't run for me using PHP 5.2.5. Is this a problem with me, or is this polyglot not valid for PHP? PeEll (talk) 15:36, 8 February 2008 (UTC)Reply

Yes, apparently this code is not completely correct for PHP 5. (Not sure about versions below 5, as I am even skeptical of even that.) However, two very minor changes in semicolon placement render this code PHP (5) compatible. The following code works with PHP 5, however causes extra output in Bash, thus it is not a sufficient solution.
#define a /*
#<?php
echo "\010Hello, world!\n";// 2> /dev/null > /dev/null \ ; // (ADDED SEMICOLON AFTER 'world!\n"')
// 2> /dev/null; x=a;
$x=5; // 2> /dev/null \ ; // (ADDED SEMICOLON AFTER  $x=5)
if (($x))
// 2> /dev/null; then
return 0;
// 2> /dev/null; fi
#define e ?>
#define b */
#include <stdio.h>
#define main() int main()
#define printf printf(
#define true )
#define function
function main()
{
printf "Hello, world!\n"true/* 2> /dev/null | grep -v true*/;
return 0;
}
#define c /*
main
#*/

However, this has the misfortunate side-effect of producing this extraneous output in Bash:

\010Hello, world!\n
polyglot.sh.php.c: line 5: a=5: command not found  —Preceding unsigned comment added by Klassica (talkcontribs) 07:52, 20 January 2009 (UTC)Reply 

Polyglot programming

edit

The concept of a program which runs in multiple languages is perhaps an academic curiosity.

In the last 5-7 years, the concept of polyglot programming (developing a system using multiple languages) has become increasingly important for professional programmers. Many web-based enterprise systems will have some .Net, Java, or PHP code, some SQL, some Javascript, and some CSS. Some will use F#, Groovy, Scala in conjunction with the more traditional OO languages. I couldn't find a wikipedia article on this concept, but I think one is needed.

References

John Y (talk) 00:19, 30 March 2012 (UTC)Reply

Explanation of the polyglot example

edit

The current explanation of the polyglot example only highlights some of the elements; what I'd really find useful is an explanation that says "In order to interpret this program in C, the following happens [explanation goes here]. Then, to interpret this program in PHP, the following happens [explanation goes here]." that kind of thing would allow the example to be "viewed" from the perspective of the given language. 2001:420:2840:1250:5955:EF7D:51DA:F509 (talk) 12:30, 3 November 2016 (UTC)Reply

Code samples

edit

@N1amr1: Sorry, I had to revert your edit. There are already too many code samples in this article, see WP:NOTREPOSITORY and WP:CODE. Adding more content to this article would be welcome. -- intgr [talk] 07:51, 26 May 2017 (UTC)Reply

External reference appropriate?

edit

The article references a paper titled "Polyglot Programming". But if you read the paper it is about using multiple programming languages when building a system - "Polyglot programming is the activity of using several programming languages in a software system". It talks about using C# and Javascript together for example.

This is a different definition to the one used in this article. I don't think the reference is appropriate here. I can find lots of examples of polyglot programs on the web, but not anything that actually first defines the term as used here.

Anyone any ideas?

SimonWiseman (talk) 12:11, 30 March 2018 (UTC)Reply

Merge with Polyglot markup, and extend

edit

I propose merging Polyglot markup into this article (but *not* Polyglot persistence, which is a distinct concept that shares a name only by analogy). This article should then be expanded to cover polyglot files generally, with polyglot programs and polyglot markup documents being subtypes. It also needs a section on the security implications of polyglots, which in my view is a much stronger claim to notability than anything currently in the article (a useful source; and another; and another; and another; possibly this one too). I would also suggest merging Gifar too, which has many issues and would work better as an example in this article rather than an article of its own. Barnards.tar.gz (talk) 21:37, 21 August 2022 (UTC)Reply

There isn't really any reference to "polyglot files" in Wikipedia right now, except the GIFAR example. And there's not much definitive out there about them - even the Chalmers link you quote defines "polyglot programs" and then goes on to talk about files without actually defining them. So I agree that the articles could be improved, but it would need to be a lot more than a 'cut and shunt' of the existing material. SimonWiseman (talk) 07:54, 22 August 2022 (UTC)Reply
Noting that all of the above is now done. Barnards.tar.gz (talk) 09:51, 6 March 2023 (UTC)Reply

Visual example of a polyglot?

edit

My apologies if im not to clear with this, but I believe having a visual example of a polyglot in computing would help this article quite a bit. I'll have to do some digging for the one in particular, but if anyone is kind enough to make one in an image format that would be simply lovely. thank you. - MountainKemono (talk) 12:02, 5 December 2022 (UTC)Reply