Hello! I'm not a "goo-roo", I'll just give my opinion on whatever I feel like I understand. There are more experienced and competent people on this list, I'm sure they'll provide more info.
24.02.2017, 22:30, "Tuom Larsen" <tuom.lar...@gmail.com>: > 1. Concatenative languages vs. tacit languages > > What is the difference? Is there any at all? Here's a good article that sheds some light on the matter: https://en.wikipedia.org/wiki/Tacit_programming Tacit style is natural in concatenative languages, but they are not necessarily limited to it. Also, tacit style is not limited to concatenative languages. For example, in Factor you may implement a function in a point-free (tacit) style: : square ( x -- x^2 ) dup * ; ... or you may have it implemented with named parameters: :: square ( x -- x^2 ) x x * ; The latter is achieved using a library, but compiles down to the same machine code. > 2. Composition > > I think I read somewhere that "function composition" is just > "concatenation" of two programs. Does it mean that I can cut any > portion of some program a paste it anywhere into some other program > and it will just work? Doesn't it make some assumption about the > stack's content, for example, which would make the program break? Well, if you paste a random chunk of a program into a random place of another program, it will most likely do something random, like throw an exception or format your hard drive. There will be some checks performed by the compiler. In fact, it'll demand that declared stack effects would match the actual stack effects of all the words involved. It will not, however perform any type checking -- that'll come in at run-time. Also, there are limits on exactly where you can cut a program, but that's details. > 3. Instruction set > > What is the minimal set of operations for a concatenative languages to > be Turing complete? I mean, how does the the most minimal > concatenative language look like? This one is not for me to answer, but I found some interesting links in this article: http://stackoverflow.com/questions/407987/what-are-the-primitive-forth-operators > 4. Quotations > > Is it fundamental to be able to pass around unevaluated code? I mean, > what is the reasoning behind "quotations"? Are they necessary for a > language to be Turing complete? Here's the "if" example: 0 1 = [ "0=1, black is white" . ] [ "we're good so far" . ] if There are two quotations. The "if" word executes either the left one, or the right one based on the boolean value preceding them. > 5. Types > > I read that it is also possible to have "types" concatenative > language. In broad terms, how does it work? Does the evaluation simply > skips the types it doesn't recognise? Does it throw an exception if > attempting to add a number and a string? It's the exception thing. A lot of evaluation is done via polymorphism. For example, the "+" word is defined for integer arguments. If you supply a string, the run-time type check will throw an exception, which will likely say that the method "+" is not defined for the class "string". You may then define such a method if you want. If you define a method for the "f" class (the class of the null object, also the most abstract thing in the class hierarchy) to be a do-nothing, you'll get no exception. ---=====--- Александр ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk