Re: Adding the ability to add functions into structures?



Walter Roberson wrote:
Albert <albert.xtheunknown0@xxxxxxxxx> wrote:

So structures are useful to group variables, so you can to
refer to a collection as a single entity. Wouldn't it be
useful to also have the ability to collect variable and
functions?

Are there any problems with adding the ability to have
functions encapsulated in structures?

structures are data, functions are code. Having the ability to
store functions (instead of function -pointers-) into structures
would require mechanisms by which data become executable. Some architectures (e.g., the Harvard architecture) cannot do that.


In architectures that do allow it, you would allow -all- of your
data to be executable (in which case you have all of the classic
stack overflow problems) or else you need a mechanism to
-dynamically- indicate that a particular block of memory is executable; the existance of such a dynamic method is not at all
certain on any particular system.

Methinks the OP wants lisp.

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on
 "show options" at the top of the article, then click on the
 "Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
.



Relevant Pages

  • Re: Adding the ability to add functions into structures?
    ... refer to a collection as a single entity. ... Wouldn't it be useful to also have the ability to collect variable and functions? ... would require mechanisms by which data become executable. ... the Harvard architecture) cannot do that. ...
    (comp.lang.c)
  • wall-e arm movement
    ... mechanisms. ... Haven't come up with a good way to get the arms, at the shoulder ... That dark band you see from top left to bottom right is supposed ...
    (rec.crafts.metalworking)
  • Re: Umra posting stats - addendum
    ... I've heard that there are two reply mechanisms in google - instead of ... at the bottom. ... Prev by Date: ...
    (uk.media.radio.archers)
  • Re: Umra posting stats - addendum
    ... Btms wrote: ... > I've heard that there are two reply mechanisms in google - instead of ... I've just replied to this via Google as a test. ... list at the bottom of it: ...
    (uk.media.radio.archers)