Arrays and pointers in C is kind of subtle thing that people can easily screw up or misunderstand if they aren't careful
The solution constituted the crucial jump in the evolutionary chain between typeless BCPL and typed C. It eliminated the materialization of the pointer in storage, and instead caused the creation of the pointer when the array name is mentioned in an expression. The rule, which survives in today's C, is that values of array type are converted, when they appear in expressions, into pointers to the first of the objects making up the array.
And for extra fun, below is an excerpt from the source code to the UNIX 7th edition C compiler (c01.c):
/* * A mention of an array is turned into * a pointer to the base of the array. */ struct tnode * disarray(ap) struct tnode *ap; { register int t; register struct tnode *p;
p = ap; /* check array & not MOS and not typer */ if (((t = p->type)&XTYPE)!=ARRAY || p->op==NAME&&p->tr1->hclass==MOS || p->op==ETYPE) return(p); p->subsp++; *cp++ = p; setype(p, decref(t), p); build(AMPER); return(*--cp); }
The C language didn't even realize what a BOOLEAN was until they officially introduced it in c99 (or was it c98)...
As for writing an OS in Haskell - a clue to you: operating systems have something called side effects, all sorts of them, at all times - Haskell tries to wish away side effects and pretend they can be magically isolated (out of site, out of mind) when obviously this is not the case. Imagine a file system that has no side effects (sorry user, you can't save your file to your hard disk - we don't allow side effects - oh wait, we just implemented a file system using MONADS with our GONADS ten years later after we realized the OS now needs side effects!)
in super mario bros one for nintendo, a continuation was the pause button on your remote control. You could pause the game and then continue it later. Someone from the Ivory Tower decided to turn this into a programming language feature.
"What are they good for?
There is more to continuations than just a parlour trick to impress Haskell newbies. They make it possible to explicitly manipulate, and dramatically alter, the control flow of a program. For instance, returning early from a procedure can be implemented with continuations. "
GOTO exitlabel; .... exitlabel: goto considered harmful but ivory tower panzies reinvented the wheel and claimed it as their own.
>>11,12 Time was when neither goto nor anything else was considered harmful.
Name:
Anonymous2015-09-13 9:25
>>10 Reality is like that. You can't always like it, but it catches onto you, and you end up spewing butthurt on textboards, which doesn't change the fact that continuations and GOTO are the same thing under different names.
Which is essentially what continuations are--GotoStatement?s that are "cleaner" with regard to the underlying machine (goto statements where the label can be saved in a variable).
>>23 Some say shitposting shapes one's own reality. If one shitposts that it's not shitposting and shitposting shapes one's own reality, is it still shitposting?
Name:
Anonymous2015-09-13 18:23
>>24 You still haven't declared a single difference between continuations and gotos, you just keep shitposting in the hope that that will magically affect reality.
Name:
Anonymous2015-09-13 21:21
LISP
Name:
Anonymous2015-09-14 4:56
is Defer in Golang just a goto that goes up, and makes it hard to reason about the prog? In fact pretty much everything is just a goto. Break is a goto, return is a goto, continue is a goto, exit is a goto, exceptions are intraprocedural gotos or COMEFROMS, traps are gotos, HALT is a goto...
Name:
Anonymous2015-09-14 9:43
Continuations are LISP's alternative to setjmp/longjmp. And they're fine. But it's still not ``goto''.
Name:
Anonymous2015-09-14 12:16
>>26 difference between continuations and gotos: continuations have natural semantics in terms of the theory of lambda calculus and are relevant to the foundations of computing science, goto doesn't have any theory except in terms of the execution model of instruction pointer based computers
Name:
Anonymous2015-09-14 13:52
>>28 this is the deluded and confused mind of a "continuations are just goto"-believer. they are not.
As for writing an OS in Haskell - a clue to you: operating systems have something called side effects, all sorts of them, at all times - Haskell tries to wish away side effects and pretend they can be magically isolated (out of site, out of mind) when obviously this is not the case. Imagine a file system that has no side effects (sorry user, you can't save your file to your hard disk - we don't allow side effects
I know, right? Gets me every time when I attempt to say add two numbers in HASCAL and can't because allocating memory for a new number is a side effect and I need a NOMAD for that. Curses!
I think HASCAL fans need to reevaluate their assumptions if they think that they can add numbers or create lists in their toy language.
reified continuations are much more similar to setjmp/longjmp than goto. Only an idiot would compare them to goto.
Name:
Going GNG is Not GNU2015-09-14 19:17
if you can implement a continuation in a procedural language and emulate continuations, then goto does have theory, because you just created continuations in C language.... Also just because it has theory behind it doesn't mean it's good. Consider the theory of evolution, which is correct - this doesn't make it good. Evolution requires 99 percent of species going extinct. It's correct, but not good. Haskell means 99 percent of haskell programmers go extinct.
comparing them to goto was just being nice. Intraprocedural gotos are even worse than local gotos. Comparing them to setjmp/longjmp is being honest, while comparing them to a goto is being nice. But since setjmp and longjmp are also known as intraprocedural gotos with more features, you can in fact use "goto" to describe continuations. You're just using LaynesLaw to try and win an argument, but it's not helping. See http://c2.com/cgi/wiki?LaynesLaw
"When a "non-local goto" is executed via setjmp / longjmp ,"
See, people view setjmp and longjmp as non local gotos.. so it's perfectly fine language to say continuations are like gotos, or more specifical non local gotos (intraprocedural).
Name:
Anonymous2015-09-14 19:31
"non local gotos" is a retard name for something that completely isn't a goto, at all - it's the same idotism that thinks continuations are related to goto.
Name:
Anonymous2015-09-14 19:39
>>38 You are going to a different part of the code, even worse so than a local goto where at least it is local which is much safer. Someone who continually brings up LaynesLaw has lost the argument, even though they tried to win it.
Name:
Anonymous2015-09-14 19:42
It goes something like this: The first stage is denial. The second stage is.. The third stage is... Then it is accepted as self evident, that continuations are non local intraprocedural gotos. Note: the first stage is denial. This is the most important stage.