Talk:Interactive programming (repl): Difference between revisions

m
Petelomax moved page Talk:Interactive programming to Talk:Interactive programming (repl): make it easier to find
m (Petelomax moved page Talk:Interactive programming to Talk:Interactive programming (repl): make it easier to find)
 
(16 intermediate revisions by 7 users not shown)
Line 1:
==Omitting languages==
Did I see some sort of "omit" template a while ago for tasks that are impossible in some languages? How do you use that? This task can't be done in a couple languages I know of. --[[User:Mwn3d|Mwn3d]] 18:39, 21 February 2009 (UTC)
 
Line 12 ⟶ 13:
:::Yup. That should do it. I don't think I've created a ''template'' to add tasks to that category, but it shouldn't be difficult. (And it's preferable to adding the pages to the category directly, as using a template allows the check mechanism to change in the future.) --[[User:Short Circuit|Short Circuit]] 18:59, 22 February 2009 (UTC)
 
==... what was the task?==
I fail to see what concatenation of strings has to do with an interpreter and the latter with the language in which the task is to be implemented. I see a solution, but what was the task? --[[User:Dmitry-kazakov|Dmitry-kazakov]] 19:03, 21 February 2009 (UTC)
:Just starting up a CLI doesn't show enough. I added what I thought would be a simple and achievable 'sub-task' so people would get some comparison of what working in the CLI of each language is like. (Which is hard to do as the feel of a CLI can depend a lot on the editing facilities that it supports). --[[User:Paddy3118|Paddy3118]] 05:07, 22 February 2009 (UTC)
Line 56 ⟶ 58:
I don't quite understand this task. First it talks about command line interpreter, and then requires creating a function. Command line interpreters do not create functions, they interpret and execute commands. If you are creating a function into a program, you are using an editor. For example, a traditional Basic interpreter uses a command mode which also acts as line editor. You can enter a direct command, and it is executed when you press enter. But if you precede the command with a line number, it is entered as a line in the program. In that case, you are using the editor. --[[User:PauliKL|PauliKL]] 21:02, 12 April 2009 (UTC)
:Hi PauliKL, Our understandings diverge. although you might create a function in a file, many languages with a CLI allow you to execute statements interactively that can create functions as well as call functions. If this cannot be done in your dialect of Basic then maybe you could explain how much of the task could be done in it? (Together with the name of the dialect of Basic) --[[User:Paddy3118|Paddy3118]] 22:10, 12 April 2009 (UTC)
 
::The point is not whether you are creating a file or not. When you are creating a program in computers memory, you are editing the program. So you are using an editor, not CLI. In the old Basic interpreters, this is done by preceding the line with a line number. In Forth, it is done by preceding the line with colon and the word to be defined. Those are just different methods of editing the program. If the task is about CLI, it would have been more logical to show some CLI operation, i.e. to execute a command immediately. --[[User:PauliKL|PauliKL]] 10:21, 13 April 2009 (UTC)
 
:But the commands are being interpreted immediately? If I type 1+1 into the Python shell it returns 2. If I type <code>def inc(n): return n+1</code> if creates the definition of a function, as soon as I hit return, I.e. immediately. The definition of a function doesn't print anything special but it is a valid action of the CLI. If you are running bash on linux, you can define functions at the command line, without storing them in a file and call them later. There ''is'' a difference between this and running commands from a file. --[[User:Paddy3118|Paddy3118]] 11:23, 13 April 2009 (UTC)
::We are not talking about difference between running a program from memory and running a program from a file. We are talking about the difference between executing commands and creating (editing) a program.
::If you open a text editor and type a piece of C code, the code is entered into the program immediately. Of course, since C is usually implemented as compiler, you would need to compile the program before running it. But it may not even be necessary to store the program from memory into a file to compile it. If I remember correctly, in the IDE of Turbo C, you could just type in the code and then run it, it was automatically compiled from memory into memory and then executed. The only visible difference to your definition of CLI is that Turbo C used full screen editor instead of line editor. --[[User:PauliKL|PauliKL]] 12:27, 13 April 2009 (UTC)
 
:I would just go back and quote something you said in your fist paragraph of this section:
::"Command line interpreters do not create functions, they interpret and execute commands"
:In Python, a language with a CLI, when in its CLI, the creation of a function is a command that is immediately executed. The action of the interpretation of the text typed in that happens to represent a function definition is to create a function 'internally'. You seem to think that a CLI's task is restricted to executing expressions with an immediate visual output, or are you merely pointing out that the notion of a CLI is not as clear cut in Basic and forth as you use the same included editor as a CLI but in different ways when not needing longer-term storage of a program? if the latter then in Basic, if you have to add line numbers at the command line to store any function to memory then I would just go ahead and show typing in of the line numbers in the function definition, and presumably leaving off the line numbers when you want the immediate effect of calling the function with arguments so that it prints a result. You could do something similar for Forth I guess. --[[User:Paddy3118|Paddy3118]] 14:03, 13 April 2009 (UTC)
 
::I did not say that execution would require visual output. Where did you get that idea? The keyword here is ''execute'', whether it is some calculation or controlling a device or whatever. It seems that you do not understand the difference between '''executing''' code and '''editing''' a program. You seem to think that defining a function executes something. It does not. Defining a function means that you add the function code into the program. That is editing. Even if it is done with a line editor. And even if some pre-compilation is done. (The line editors of most Basic interpreters actually pre-compile each line that is inserted into the program.) --[[User:PauliKL|PauliKL]] 15:46, 15 April 2009 (UTC)
 
::: In a CLI as thought here, defining a function executes something: the definition of the function. Defining a function means the interpreter e.g. creates a new symbol-code bound. It's absolutely not editing the code; how the interpreter stores the definition, is not essential. Editing the code means using a text editor; the interpreter does not know nothing about you editing a file, until you run the interpreter over that file. Instead, the CLI '''is''' the interpreter itself (it is a way it can operate: instead of feeding it with a complete source, you interactively give commands to it, according to the same syntax you would use while writing the source in your preferred editor). Of course, to make a good experience to use the interpreter in such an interactive way, the CLI is also a line-editor... but once you hit enter, what you've written is interpreted, so even you can recall a previous input line, that line was already interpreted, and changing it will just make you able to re-run a changed copy of it. I.e. it is not luckly like a telnet session. (See readline library). --[[User:ShinTakezou|ShinTakezou]] 17:07, 15 April 2009 (UTC)
 
::: '''Seen''' the BASIC code. Does it work even if you remove the 10? --[[User:ShinTakezou|ShinTakezou]] 17:14, 15 April 2009 (UTC)
 
:Hi PauliKL, Forth and basic come from a time (the 80's), when it made sense to include an editor that could save programs to more permanent storage, as part of the language. Since then it has become more common to separate the programming language from any editor. You seem to stumble over the fact that in the modern use of the term CLI, you can define functions, and classes etc as part of a CLI session. I say you can and so the task is valid, you say you can't and so the task is invalid. I have already sugested that you are at liberty to state that the addition of line numbers in your version of Basic which you say is necessary for the creation of functions is viewed as an editor function for that version of Basic (Their are other versions of Basic that don't even require line numbers). We may have a difference in semantics and maybe your explanation for your version of Basic will avoid any confusion. To say that what is correct nomenclature for basic is true for other languages doesn't help. We have been discussing this issue for several days now and their are several entries on the page by other authors who don't see a problem. --[[User:Paddy3118|Paddy3118]] 19:50, 15 April 2009 (UTC)
 
: FWIW, with [[Tcl]]'s CLI (or a Tcl script) you create new executable symbols (commands, functions, procedures, whatever you want to call them) by issuing a command to create them. Thus, I think that to say that a CLI can't create new symbols is to introduce a totally arbitrary distinction in general (that just happens to correspond to ''some'' language's restrictions). The key distinction is between those where you can type in code interactively, and those where you have to describe it completely separately from executing it, typically because an explicit compilation step is required. And yet, I have seen a CLI for [[C]], so I suppose anything is possible with enough cleverness... –[[User:Dkf|Donal Fellows]] 09:12, 23 January 2010 (UTC)
 
==Omit AWK?==
Rather than include the current entry? --[[User:Paddy3118|Paddy3118]] 07:21, 23 January 2010 (UTC)
 
==Where's Lhogho??==
A quick search shows that the language is a version of Logo; a Logo compiler. I removed the Lhogho entry as it didn't complete the task.
 
The best way to add a Lhogho example would be to put it under the Logo language and point out any differences it has to any existing Logo implementation or what makes it Lhogho specific if anything. There would be no need for duplicating any example in its entirety. --[[User:Paddy3118|Paddy3118]] 08:40, 14 June 2010 (UTC)
:Point taken. I should've read the blurb on the task too. --[[User:Axtens|Axtens]] 08:46, 14 June 2010 (UTC)
::Mind you, Lhogho doesn't have an interactive mode AFAICT
7,803

edits