Talk:Icon (programming language)
This is the talk page for discussing improvements to the Icon (programming language) article. This is not a forum for general discussion of the article's subject. |
Article policies
|
Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
![]() | This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||
|
regular expressions
[edit]Just for historical purposes..
One of the frequent requests in the old Icon mailing list for Icon was adding regular expression support to the language. Unfortunately, I'm not sure who responded, but the best comeback to one of these requests was:
Asking for regular expressions in Icon is like asking for training wheels for a Harley
CheyenneWills 16:40, 29 September 2006 (UTC)
lists and tables
[edit]most modern scripting languages combine lists and tables into a single feature
I'm not aware of any evidence to support this claim.
In fact, I have never seen this ! To take the most well-known, Perl, Python, Ruby don't do this ! 213.244.14.206 14:56, 19 June 2007 (UTC)
- The article was updated and text, objected to, removed a long time ago by Jibal here: [Difference between revisions from 7/20/2007 to 8/6/2007]. I have never closed or archived a talk discussion before, guessing archive is the next step, waiting on advice or intervention by more experienced editor before preceding. Thank you. Ronaldws (talk) 22:38, 20 August 2022 (UTC)
- There is a lot of ancient moot commentary on talk pages ... no need to close or archive it. Your comment is enough to alert editors that the text was removed (which I presumably did upon reading this comment 15 years ago).
- Later comments here note that there are other scripting languages that do this, but the claim that "most modern scripting languages" do seems excessive, needs a reliable source else it is original research, and simply isn't necessary in an article about Icon. Jibal (talk) 22:59, 21 August 2022 (UTC)
Lua does this, but I can't think of any others that do. 72.146.170.188 (talk) 20:25, 4 August 2008 (UTC)
REXX does this as well. REXX's stem variables are used to handle both associative arrays (tables) and lists (numerical indexed arrays). The underlying implementation just treats them as the same type of "object" and the whole concept of using stem variables to handle lists is just an accepted common REXX programming convention. CheyenneWills (talk) 16:39, 26 September 2008 (UTC)
My understanding is that arrays in PHP scripts, arrays in bash scripts, and arrays in JavaScript can be used as both associative arrays and numerical indexed arrays. (Although "Some people think that you shouldn't use [a JavaScript] array as an associative array."[1]). Do you merely not know this, or are you trying to crack a joke implying that bash, JavaScript, and PHP are not "modern scripting languages"? Would the talk page for associative array#Language support be a better place for this discussion? --DavidCary (talk) 15:10, 19 December 2014 (UTC)
license
[edit]Do anybody know what is the license on Icon implementation and IPL? I have found no trace of license on their website. 83.246.135.39 (talk) 10:49, 31 October 2009 (UTC)
The base source of Icon is in the public domain (as per the README file in the source tar file). Included with the base source are two sub-directories that have some licensed code, one from Microsoft in the wincap directory, the other is a copy of XPM, which is copyrighted by GROUPE BULL. Both licenses are basically AS-IS licenses, allowing redistribution of the source. Both sets of sources are only utilized if creating the graphics version of Icon. Within the Icon Program Library, most of the source is public domain, there are a few source files that are copyrighted, or have included copyrighted code. CheyenneWills (talk) 00:59, 3 November 2009 (UTC)
The search example is a bit unfair about the verbosity of other languages. The example could be written as
char *s = "All the world's a stage. And all the men and women merely players";
int i = 0;
while ( -1 != ( i = indexOf("the",s,i)) ) write(i++);
— Preceding unsigned comment added by 82.14.176.247 (talk) 09:51, 21 April 2013 (UTC)
other icon programming languages
[edit]I see that visual programming language and de: iCon-L mention a programming language with a similar-sounding name. Does this article need a wp: hatnote to help readers who end up here while looking for that other programming language? --DavidCary (talk) 15:16, 19 December 2014 (UTC)
- The visual programming language really refers to possible confusion with a graphical icon described by the wikipedia article Icon (computing). The de: iCon-L software product and graphical programming system still exists today, over 7 years later, does not seem to be going away and the web site of the company has pages for the product in English. A disambiguation page appears to make sense ... perhaps something like (two proposals but preferring the first):
- Ronaldws (talk) 23:01, 21 August 2022 (UTC)
icon syntax highlighting lost
[edit]Since the switch from Geshi to Pygments for syntax highlighting (phab:T85794), support for 'icon' and 'unicon' was unfortunately dropped, as can be seen with the plain text formatting on this page and many others like Unicon (programming language) and Generator_(computer programming). If you want specialised syntax highlight support again, it will need to be added to Pygments. However we could also add a compatibility fallback, e.g. to 'pascal' which works quite well for highlighting these languages. John Vandenberg (chat) 12:57, 14 July 2015 (UTC)
Criticism section
[edit]Some of the "Criticism" section feels opinion.
The linked paper that is the basis for the criticism section is a reference to the experiences in developing a new language (Converge) that was derived as a cross between Icon and python.
Some of the design considerations of Icon were derived from Snobol, where the concept of success/failure instead of boolean is one of primary features of that language. Icon, like Snobol, does require a different way of "thinking" because of the use of success/failure instead of using booleans. To a Snobol programmer, this behavior of Icon does feel "natural".
As with many programming languages there can be nuances that can trip up a programmer, especially if the language has concepts that are radically different from other programming languages. Because there are some radical differences, there are typically idiomatic ways of performing certain operations. The similarity of syntax with other languages can further lead to confusion since there might be an expectation of common behavior. To give an example, C's uses and idiom of 0 as "false" and everything else as "true", while Icon's idiom is to use a conditional expression to check the value that you want. This is not saying that C is wrong and Icon is correct, it's just that they are different. In some languages (e.g. pascal) there is a boolean data type and using an non-boolean variable as a raw check for true/false produces a compile time syntax error.
The design choice of success/failure is documented in the introduction to Icon and as well as being covered in the 1st chapter of Icon Programming Language book. The points brought up in the criticism are covered the topic 'Success and Failure' in the Icon Programming Language book has notes of caution when using Icon due to the differences with success/failure and boolean logic (e.g. the fact that failure is inherited by the assignment operator, and that use of conditional expressions).
To rework the specific examples given in a more "Iconic" fashion:
x := 10 ... x := f(-1) | &null # if f fails, assign a default value write("f(-1) is ", \x | "undefined")
if /c then { # Use a conditional expression to check to see if c is &null write("taken") }
It should also be noted that the 2nd example given was misquoted from the original article. In the article, the example firsts sets c to 10 (c := 10) then performs the test, this is followed by removing the assignment and repeating the test. The default value of an initialized variable is &null not zero
CheyenneWills (talk) 22:51, 22 June 2021 (UTC)
hmm
[edit]A lot of the examples on the evaluation differences are wrong. For ex. it works the same way with while (var=readLine()) write(var); in at least C and PHP, no need to check for null manually or catch exceptions. It will return with empty/falsey value when done.
Also for most statements such as IF’s you can do stuff like:
if ($var = fnCall() && …)
since it’s a boolean test it will get implicitly cast as that right after the assignment… I probably failed to articulate that right, but my point is you get the value in the variable and the test can still fail and short circuit
The paper called it backtracking in another example where I’d just say the expression was aborted/cancelled before the assignment was done… just seems heavy with exaggerations when almost all I’ve seen work pretty much the same in any language.
Ok maybe not aborting an assignment - but then again… I haven’t checked if this works, but should give the same result in for example javascript as if you never defined the var at all:
var = booleanCheck() ? value : undefined; 81.235.181.45 (talk) 06:07, 27 February 2022 (UTC)
- "It works the same way with "
while (var=readLine()) write(var);
"in at least C and PHP" ... Perl apparently needs magic suggesting an advantage for the success / failure model. An example of the problem that chokes Perl is a text file that ends with "prev text\nlastish line\n0" so that the very last line just has the numeral 0 with no trailing newline. When Perl evaluates the string "0" it evaluates to false so as documented in a few places including, "Learning Perl", R Schwartz, T Phoenix https://docstore.mik.ua/orelly/perl3/lperl/ch06_01.htm, Perl magically adds a defined test to code likewhile (<STDIN>) { ...
}. In PHP the example from PHP.net works correctlywhile (($line = fgets($handle)) !== false) { ... }
butwhile ($line = fgets($handle)) { ... }
fails similarly to Perl.
- The short circuit evaluation misses the point of the paragraph which is trying to show an example of data backtracking to provide atomicity, and so the point is about undoing the assignment of variable
i := 10
back to the value ofi
before the block. The article does not appear to discuss control backtracking which could be todo, possibly after the section on Generators. The example in the Wikipedia article shows data backtracking and forgets some modified data in the block whereas control backtracking may move back execution of the program within an expression (maybe block?), for example to generate a "next" value from an earlier generator before moving ahead to iterate through subsequent generators.
Ronaldws (talk) 00:53, 16 August 2022 (UTC)
Perl magically adds a defined test to code like while (<STDIN>) { ...}.
- FWIW, it didn't in early versions. I pointed out the case that fails on a Perl usenet group and Larry Wall responded by adding the hacky
defined
test towhile (<...>)
- Since you appear to be knowledgeable about Icon, it would be nice if you could fix some of the issues in the article. Jibal (talk) 23:08, 21 August 2022 (UTC)
"if the operations to the right evaluate to true" confusing ... perhaps better "if the conditional evaluates to a true value"
[edit]
Above code block write(a < b)
in section: Goal-directed_execution
"if the operations to the right" ... Icon programming class from U of Arizona many years ago and rusty but bold part of quote confusing. Likely, based on textbook, better written "if the conditional evaluates to a true value". Likewise: "if the operations to the right succeed" maybe better written "if the conditional evaluation is successful and does not fail". Ronaldws (talk) 00:59, 12 August 2022 (UTC)
- Sounds right ... WP:bebold and go ahead and make such improvements. Jibal (talk) 23:11, 21 August 2022 (UTC)
- Tried putting in this update and #other_icon_programming_languages. Ronaldws (talk) 01:30, 26 August 2022 (UTC)