C
cr88192
Mark Bluemel said:I'm oriented to object to your suggestions...
are you saying these statements are not concurrent?...
Mark Bluemel said:I'm oriented to object to your suggestions...
cr88192 said:often cases, yes.
none the less, people tend to dislike this kind of thing in C land (even as
such, it happens sometimes), albeit it is a very common occurance in most
non-C languages (where there are hidden runtime calls pretty much
everywhere...).
Chris Dollin said:A functional programmer will sneer at this feeble attempt at higher-order
programming.
Richard said:A real programmer will laugh at that feeble attempt to equate "more
abstracted" with "higer order".
James Kuyper said:Why do you think people tend to dislike it, and why do you think it's an
uncommon feature of C compilers?
Whether it's better to implement a feature using a function call or by
inlining the code that would otherwise be in such a function is precisely
the kind of optimizing detail that I want the compiler to worry about, not
me.
cr88192 said:having compilers that produce code unsuitible for OS development is one
reason.
in userspace, there is less reason for concern.
well, the reason it would involve a function call, is because it would have
to allocate memory for the binding frames (an inherently non-inlining
operation).
worse yet, absent GC, of explicitly freeing function pointers (probably via
a special function), there is no real way to know when exactly these
closures/binding frames are no longer needed, so one will end up with a
memory leak...
cr88192 wrote:
Again, this isn't my area of current expertise, but back when I did do
assembly language programming, in none of the three languages I
learned did executing a function require allocation of memory in a
fashion that was difficult to deallocate. Memory was allocated as
needed from the stack by the simple expedient of changing the value of
a register, and it was returned to the stack by the simple expedient
of restoring the original value of that register. I'm sure more
complicated schemes are needed on other platforms.
I'm sure that you're talking about something much more complicated
than what I'm thinking of. But is there any reason why "inserting
runtime function calls ... whenever we use certain language features"
has to refer to what you're thinking of, rather than what I'm thinking
of?
Chris said:(e-mail address removed) wrote: ....
I believe he's exclusively thinking of support for upward closures
(ie nested functions that access outer locals and are also exported
out of the enclosing function), and he seems to think that constructing
such a closure would /have/ to involve a function call.
Chris Dollin said:I believe he's exclusively thinking of support for upward closures
(ie nested functions that access outer locals and are also exported
out of the enclosing function), and he seems to think that constructing
such a closure would /have/ to involve a function call.
It's true that an upward closure claims store that there's no way of
freeing without GC (or some extra run-time functionality, eg a
`freeClosure` function, and the necessary discipline to keep track
of whether a function is or is not a closure, bleach), and it's false
that constructing the closure would /need/ a function call, although
it might be /sensible/ to put sharable construction code into a
library function.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.