Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #1967
| From | George Neuner <gneuner2@comcast.net> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Add nested-function support in a language the based on a stack-machine |
| Date | 2018-03-01 13:49 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <18-03-003@comp.compilers> (permalink) |
| References | (2 earlier) <18-02-016@comp.compilers> <18-02-018@comp.compilers> <18-02-023@comp.compilers> <18-02-029@comp.compilers> <18-02-032@comp.compilers> |
On Sat, 17 Feb 2018 16:13:10 +0000 (UTC), Kaz Kylheku <217-679-0842@kylheku.com> wrote: >On 2018-02-15, George Neuner <gneuner2@comcast.net> wrote: >> On Wed, 14 Feb 2018 18:06:40 +0000 (UTC), Kaz Kylheku >><217-679-0842@kylheku.com> wrote: >> >>>On 2018-02-14, George Neuner <gneuner2@comcast.net> wrote: >> ... you're correct that the display needs to be counted >> as part of the thread switch context. But each thread also would be >> using from a separate stack, so having the entire display saved in >> each frame is overkill when all that's needed is a single pointer. > >The address of a local function can be taken. When that function is >called from any context, possibly another thread, it has access to the >locals that were lexically apparent there. You Lisp is showing. IOW, that's language dependent. There are perfectly useable languages that do not allow taking the address of a function ... never mind passing such pointers between threads. Upcalls / callbacks / completion functions, etc. do require the ability to specify the target function, but there isn't any reason for the language to expose that to the programmer. And in such cases the stack environment required by the called function exists at the point where the function is called. >Stack *access* is shared among threads. E.g. a thread can register >a stack object in a shared queue (such as a synchronization wait queue). >As long as it is dequeued before that frame terminates, everything is >cool. Commonly done. Again, language dependent. Your hypothetical stack resident object need not be any kind of "active" object. And if the [shared entity] is provided a callback function [by whatever means the language permits], there is no problem as long as the lexical environment of that function still exists. Have you never used multi-threaded Pascal? >If a downward-only lexical closure is implemented as a pointer into some >threads's stack memory (plus a function) that object can be passed to >another thread and used (as long as the context which created that >closure doesn't terminate). Yes it can. And the result is something akin to co-routine. But there's no reason any particular language should allow it. Many of your arguments are based on the notion of a general purpose language needing to provide full closures and objects ... but in a more restricted domain specific setting there often are perfectly good arguments for NOT providing general purpose features. We really don't know what the OP is trying to do. It is good to point out limitations of an idea and to bring up alternatives where viable, but let's not go too crazy here until we know more. YMMV, George
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Add nested-function support in a language the based on a stack-machine dror.openu@gmail.com - 2018-02-12 11:25 -0800
Re: Add nested-function support in a language the based on a stack-machine dror.openu@gmail.com - 2018-02-12 14:16 -0800
Re: Add nested-function support in a language the based on a stack-machine Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2018-02-13 12:10 +0100
Re: Add nested-function support in a language the based on a stack-machine Louis Krupp <lkrupp@nospam.pssw.com.invalid> - 2018-02-13 00:42 -0700
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <217-679-0842@kylheku.com> - 2018-02-14 00:59 +0000
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-02-13 22:04 -0500
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <217-679-0842@kylheku.com> - 2018-02-14 18:06 +0000
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-02-15 11:41 -0500
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <217-679-0842@kylheku.com> - 2018-02-17 16:13 +0000
Re: Add nested-function support in a language the based on a stack-machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2018-02-17 16:39 +0000
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-03-01 13:48 -0500
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <217-679-0842@kylheku.com> - 2018-03-01 19:26 +0000
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <217-679-0842@kylheku.com> - 2018-03-02 00:38 +0000
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-03-02 02:48 -0500
Re: Add nested-function support in a language the based on a stack-machine rpw3@rpw3.org (Rob Warnock) - 2018-03-03 16:00 +0000
Re: Add nested-function support in a language the based on a stack-machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2018-03-02 09:30 +0000
Re: Add nested-function support in a language the based on a stack-machine anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2018-03-05 15:01 +0000
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-03-05 15:51 -0500
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-03-05 14:39 -0500
Re: Add nested-function support in a language the based on a stack-machine John Levine <johnl@taugh.com> - 2018-03-06 04:31 +0000
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <217-679-0842@kylheku.com> - 2018-03-06 18:17 +0000
Re: Add nested-function support in a language the based on a stack-machine Kaz Kylheku <157-073-9834@kylheku.com> - 2018-03-11 03:19 +0000
Re: Add nested-function support in a language the based on a stack-machine Tomasz Kowaltowski <tk@ic.unicamp.br> - 2018-03-06 12:10 -0300
Re: Add nested-function support in a language the based on a stack-machine bartc <bc@freeuk.com> - 2018-03-06 19:02 +0000
Re: Add nested-function support in a language the based on a stack-machine antispam@math.uni.wroc.pl - 2018-04-29 16:29 +0000
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-03-01 13:49 -0500
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-02-13 22:37 -0500
Re: Add nested-function support in a language the based on a stack-machine George Neuner <gneuner2@comcast.net> - 2018-02-13 23:27 -0500
Re: Add nested-function support in a language the based on a stack-machine Shoefoot <shoefoot@gmail.com> - 2018-02-14 12:27 -0800
csiph-web