as im being accused on talkin not on topics
(partially it may be true but its from practical reasons, i often
do and think on more standard c sometimes im focused on deeper c)
note hovever discussing c extensions and ideas is quite regular and
natural in this group i only did possibly more of this than anybody
(or most)
for exampla i remembered some people doscussed concept of functions
inside functions in c and this my concept of this "fractal modularity"
(or "hipermodularty) in wider scope realizes this
i began to think on this becouse wider hipermodularity in fact im sure
is right way but yeilds to some harder decisions becouse many things are
yet not clear so maybe i think i could consider /rethink this more
narrow scope to get for some conclusion - see for example this
this kinda proves that
1) functions in functuions finally shows to be good idea
2) its quite close if adding it to objects as in oop
(not fully as many impelenetationsof this oop (wth this
net of pointers) is total trash i eman on this more proper
"entity" form of objects (this entity form i personally usualy name as module, but it also could be named repaired object in short object)
float* f = new float; //oop trash way
float f;˙˙ //'entity' way/right way/c way (in this way f could be named
as object imo or module )
so the example
int print(char*txt)
{
˙ int n = printf(txt);
˙ chars+=n;
˙ calls++;
˙ return n;
˙ static int˙ calls = 0;
˙ static int˙ chars = 0;
˙ float average()˙˙˙ {˙ return float(chars)/calls;}
˙ void printf_average() {˙ printf("calls %d, chars%d, average chars on
call %f ", calls, chars, average()˙ ); }
˙ void reset() {calls =0; chars =0;}
˙};
this alone maybe not opens so many questions, some may just use it
on c standard rules
main()
{
˙print("sdsdssfd");
˙print("sdsdsddsdsfd");
˙print. printf_average();
}
evenyually someone could ask if to add a parent function name prefix
here as obligatory
˙print. printf_average(); //this ?
˙print˙ printf_average(); //this ?
˙printf_average();˙ //or this?
in my opinieon (but not decisive/final only for the consideration at the moment) probably all 3 should be allowed
probably in this moment
1) usability of this functions in functions is clear
2) not much language problems arise
BUT THE GENERALISATIONS of it (i mean draggging that functions into
being treated as a structure NOW MANY PROBLEMS arise (and on this maybe later)
note yet one thing
in c you have either scope global or local
for exampla i remembered some people doscussed concept of functions
inside functions in c and this my concept of this "fractal
modularity" (or "hipermodularty) in wider scope realizes this
On Wed, 16 Sep 2026 21:42:54 +0200, fir wrote:
for exampla i remembered some people doscussed concept of functions
inside functions in c and this my concept of this "fractal
modularity" (or "hipermodularty) in wider scope realizes this
It?s called ?nested functions?. The GNU C compiler already has this.
It has some implications for functions as first-class objects: the
address of an inner function has to be implemented via a thunk, which
is usually created on the stack. This requires an executable stack.
foo()
{
˙ static int* p = NULL;
˙ f();
˙f()
{
˙ p= realloc(p, 2000);
}
}
bar()
{
˙ f();// ????this probably shouldnt compile as f is not down the branch here (i not rethinked it yet fully)
}
main()
{
˙ bar();
˙ foo() ;;
}
fir pisze:
foo()
{
˙˙ static int* p = NULL;
˙˙ f();
˙˙f()
{
˙˙ p= realloc(p, 2000);
}
}
wel this example is a bit flawed it should be
foo(int n)
{
˙˙ static int* p = NULL;
˙˙ p= realloc(p, 2000);
˙˙ f();
˙ f()
˙{
˙ //uses p
˙˙ /so in fact it have sense that only˙ functions down the branch of foo
˙˙ //could call it
˙}
˙}
bar()
{
˙˙ f();// ????this probably shouldnt compile as f is not down the
branch here (i not rethinked it yet fully)
}
main()
{
˙˙ bar();
˙˙ foo() ;;
}
On Wed, 16 Sep 2026 21:42:54 +0200, fir wrote:
for exampla i remembered some people doscussed concept of functions
inside functions in c and this my concept of this "fractal
modularity" (or "hipermodularty) in wider scope realizes this
It?s called ?nested functions?. The GNU C compiler already has this.
It has some implications for functions as first-class objects: the
address of an inner function has to be implemented via a thunk, which
is usually created on the stack. This requires an executable stack.
as im being accused on talkin not on topics
(partially it may be true but its from practical reasons, i often
do and think on more standard c sometimes im focused on deeper c)
note hovever discussing c extensions and ideas is quite regular and
natural in this group i only did possibly more of this than anybody
(or most)
for exampla i remembered some people doscussed concept of functions
inside functions in c and this my concept of this "fractal modularity"
(or "hipermodularty) in wider scope realizes this
i began to think on this becouse wider hipermodularity in fact im sure
is right way but yeilds to some harder decisions becouse many things are
yet not clear so maybe i think i could consider /rethink this more
narrow scope to get for some conclusion - see for example this
this kinda proves that
1) functions in functuions finally shows to be good idea
2) its quite close if adding it to objects as in oop
(not fully as many impelenetationsof this oop (wth this
net of pointers) is total trash i eman on this more proper
"entity" form of objects (this entity form i personally usualy name as module, but it also could be named repaired object in short object)
float* f = new float; //oop trash way
float f;˙˙ //'entity' way/right way/c way (in this way f could be named
as object imo or module )
so the example
int print(char*txt)
{
˙ int n = printf(txt);
˙ chars+=n;
˙ calls++;
˙ return n;
˙ static int˙ calls = 0;
˙ static int˙ chars = 0;
˙ float average()˙˙˙ {˙ return float(chars)/calls;}
˙ void printf_average() {˙ printf("calls %d, chars%d, average chars on
call %f ", calls, chars, average()˙ ); }
˙ void reset() {calls =0; chars =0;}
˙};
this alone maybe not opens so many questions, some may just use it
on c standard rules
main()
{
˙print("sdsdssfd");
˙print("sdsdsddsdsfd");
˙print. printf_average();
}
evenyually someone could ask if to add a parent function name prefix
here as obligatory
˙print. printf_average(); //this ?
˙print˙ printf_average(); //this ?
˙printf_average();˙ //or this?
in my opinieon (but not decisive/final only for the consideration at the moment) probably all 3 should be allowed
probably in this moment
1) usability of this functions in functions is clear
2) not much language problems arise
BUT THE GENERALISATIONS of it (i mean draggging that functions into
being treated as a structure NOW MANY PROBLEMS arise (and on this maybe later)
On 16/09/2026 21:42, fir wrote:
as im being accused on talkin not on topics
(partially it may be true but its from practical reasons, i often
do and think on more standard c sometimes im focused on deeper c)
note hovever discussing c extensions and ideas is quite regular and
natural in this group i only did possibly more of this than anybody
(or most)
for exampla i remembered some people doscussed concept of functions
inside functions in c and this my concept of this "fractal modularity"
(or "hipermodularty) in wider scope realizes this
i began to think on this becouse wider hipermodularity in fact im sure
is right way but yeilds to some harder decisions becouse many things
are yet not clear so maybe i think i could consider /rethink this more
narrow scope to get for some conclusion - see for example this
this kinda proves that
You have not "proven" anything of the sort.˙ But nested or local
functions are a feature people find useful in many languages.˙ gcc
supports them as an extension in C, and a great many languages
(including C++, Objective-C, and D, which are all "C-like" languages).
1) functions in functuions finally shows to be good idea
2) its quite close if adding it to objects as in oop
(not fully as many impelenetationsof this oop (wth this
net of pointers) is total trash i eman on this more proper
"entity" form of objects (this entity form i personally usualy name as
module, but it also could be named repaired object in short object)
No, it is not.
float* f = new float; //oop trash way
float f;˙˙ //'entity' way/right way/c way (in this way f could be
named as object imo or module )
It's clear that you have no idea what OOP means, and pretty much zero knowledge of C++.˙ The focus here is obviously C rather than C++, but it doesn't help your argument when you dismiss C++ this way.˙ If C were
ever to gain standardised nested functions, they would be lambdas in a
C++ style (this is already in progress as a set of proposals lead by
Jens Gustedt).˙ Similarly, if namespaces (which i
That is not an "object" (and certainly not "OOP"), nor is it nested functions in any real sense - it is a namespace where one of the
functions has its definition muddled up.˙ Really, what you have is :
namespace print {
˙˙˙˙int calls = 0;˙˙˙˙˙˙˙ // Inherently static in a namespace
˙˙˙˙int chars = 0;
˙˙˙˙int print(char * txt) {
˙˙˙˙˙˙˙ int n = printf(txt);
˙˙˙˙˙˙˙ chars += n;
˙˙˙˙˙˙˙ calls ++;
˙˙˙˙˙˙˙ return n;
˙˙˙˙}
˙˙˙˙float average() { return float(chars) / calls; }
˙˙˙˙...
}
˙˙print. printf_average(); //this ?
˙˙print˙ printf_average(); //this ?
˙˙printf_average();˙ //or this?
in my opinieon (but not decisive/final only for the consideration at
the moment) probably all 3 should be allowed
Allowing all three is worse than choosing any single option, no matter
how bad that option may be.
note i her gave two examples
1) print() but with accesible fields (of its aclls and chars printed )
and cunstions (to show it)
2) reallocalbe 2d array contained in function
few days ago i was giving example of slog() routines which is
combination of the two (it has rectangle ram buffer where you write text into (by vsprintf) and you mat draw this slog ram buffer onto
screen (by winapi/gdi based function)
so this open a question how to sho this slog in such form of one
function
the problem is this slog has its main function and if it this function should be used for initialisation or for printing then ??
in fact you can define it as you want but should it be somewhat fixed on language level?
i dont know i woule probably design it like this
slog(char* txt, ...)
{
//˙ if(!buf) buf = realloc(buf, w*h);
˙ if(!buf) resize(100, 200);
˙ // pass to vsnprintf here
˙ return;
//˙ static int w = 100;
//˙ static int h = 200;
˙ static w =0, h=0;
˙ static char* buf = NULL;
˙ void resize(int _w, int _h) {w=_w;_h=h; buf = realloc(buf, w*h);}
˙ void draw(int x, int y) { //use gdi calls here}
}
this opens some problem hobvever
1) you need to hardcode default w,h size in this function (as you dont
call init as instantiation) and/or you need to pass thru this pointer
check if its initialised
so thismay suggest its not purely theoratically good here in this form
so it needs some thinking
this is also not bad hovever for c user (i personally use suchkind of "init key" pointers or how to name it in my c codes)
David Brown pisze:
˙˙print. printf_average(); //this ?
˙˙print˙ printf_average(); //this ?
˙˙printf_average();˙ //or this?
in my opinieon (but not decisive/final only for the consideration at
the moment) probably all 3 should be allowed
Allowing all three is worse than choosing any single option, no matter
how bad that option may be.
not really
c tradition i guess would be the third - no prefixes
but 1&|2˙ (1 and/or 2 ..i men 1 o2 or both) is needed
- this allows you to use many short names for inner functions and do not make conflict if they are in scope just use prefix - but as i said such decision on specified syntax must be dalayed )
David Brown pisze:
That is not an "object" (and certainly not "OOP"), nor is it nested
functions in any real sense - it is a namespace where one of the
functions has its definition muddled up.˙ Really, what you have is :
namespace print {
˙˙˙˙˙int calls = 0;˙˙˙˙˙˙˙ // Inherently static in a namespace
˙˙˙˙˙int chars = 0;
˙˙˙˙˙int print(char * txt) {
˙˙˙˙˙˙˙˙ int n = printf(txt);
˙˙˙˙˙˙˙˙ chars += n;
˙˙˙˙˙˙˙˙ calls ++;
˙˙˙˙˙˙˙˙ return n;
˙˙˙˙˙}
˙˙˙˙˙float average() { return float(chars) / calls; }
˙˙˙˙˙...
}
ye thats right.. its nice you understand it
but now:
I. it is an object but as i said i consider this as a "narrowed"
piece of more general exctension where thsi function is an "object"
(bot not quite c++ trash object but close though repaired) ..in
this narrow sense it yet not be may seen it is
so the example
int print(char*txt)
{
˙˙ int n = printf(txt);
˙˙ chars+=n;
˙˙ calls++;
˙˙ return n;
˙˙ static int˙ calls = 0;
˙˙ static int˙ chars = 0;
˙˙ float average()˙˙˙ {˙ return float(chars)/calls;}
˙˙ void printf_average() {˙ printf("calls %d, chars%d, average chars
on call %f ", calls, chars, average()˙ ); }
˙˙ void reset() {calls =0; chars =0;}
˙˙};
That is not an "object" (and certainly not "OOP"), nor is it nested functions in any real sense - it is a namespace where one of the
functions has its definition muddled up.
On 17/09/2026 12:58, fir wrote:
David Brown pisze:
That is not an "object" (and certainly not "OOP"), nor is it nested
functions in any real sense - it is a namespace where one of the
functions has its definition muddled up.˙ Really, what you have is :
namespace print {
˙˙˙˙˙int calls = 0;˙˙˙˙˙˙˙ // Inherently static in a namespace
˙˙˙˙˙int chars = 0;
˙˙˙˙˙int print(char * txt) {
˙˙˙˙˙˙˙˙ int n = printf(txt);
˙˙˙˙˙˙˙˙ chars += n;
˙˙˙˙˙˙˙˙ calls ++;
˙˙˙˙˙˙˙˙ return n;
˙˙˙˙˙}
˙˙˙˙˙float average() { return float(chars) / calls; }
˙˙˙˙˙...
}
ye thats right.. its nice you understand it
but now:
I. it is an object but as i said i consider this as a "narrowed"
piece of more general exctension where thsi function is an "object"
(bot not quite c++ trash object but close though repaired) ..in
this narrow sense it yet not be may seen it is
An "object" has to be re-usable - you have to be able to have multiple independent instances of the object type.˙ If all your data fields are "static", you can only have one of them - and you have a namespace,
rather than an object type.
or treat it as separate
foo a,b,c, tab[10];
or treat it as separate
foo a,b,c, tab[10];
Lawrence D?Oliveiro pisze:
interesting, i didnt knew that
On Wed, 16 Sep 2026 21:42:54 +0200, fir wrote:
for exampla i remembered some people doscussed concept of
functions inside functions in c and this my concept of this
"fractal modularity" (or "hipermodularty) in wider scope realizes
this
It?s called ?nested functions?. The GNU C compiler already has
this.
It has some implications for functions as first-class objects: the
address of an inner function has to be implemented via a thunk,
which is usually created on the stack. This requires an executable
stack.
but it seems it doesnt work as it should
in cas im talking about those inner functions
1) has visibility as it was not inner (like normal)
On Thu, 17 Sep 2026 09:49:09 +0200, fir wrote:
Lawrence D?Oliveiro pisze:
interesting, i didnt knew that
On Wed, 16 Sep 2026 21:42:54 +0200, fir wrote:
for exampla i remembered some people doscussed concept of
functions inside functions in c and this my concept of this
"fractal modularity" (or "hipermodularty) in wider scope realizes
this
It?s called ?nested functions?. The GNU C compiler already has
this.
It has some implications for functions as first-class objects: the
address of an inner function has to be implemented via a thunk,
which is usually created on the stack. This requires an executable
stack.
but it seems it doesnt work as it should
in cas im talking about those inner functions
1) has visibility as it was not inner (like normal)
Nothing that is defined local to a scope is supposed to be visible
outside it. That?s the whole point of ?local scope?.
Lawrence D?Oliveiro pisze:
On Thu, 17 Sep 2026 09:49:09 +0200, fir wrote:
Lawrence D?Oliveiro pisze:
interesting, i didnt knew that
On Wed, 16 Sep 2026 21:42:54 +0200, fir wrote:
for exampla i remembered some people doscussed concept of
functions inside functions in c and this my concept of this
"fractal modularity" (or "hipermodularty) in wider scope realizes
this
It?s called ?nested functions?. The GNU C compiler already has
this.
It has some implications for functions as first-class objects: the
address of an inner function has to be implemented via a thunk,
which is usually created on the stack. This requires an executable
stack.
but it seems it doesnt work as it should
in cas im talking about those inner functions
1) has visibility as it was not inner (like normal)
Nothing that is defined local to a scope is supposed to be visible
outside it. That?s the whole point of ?local scope?.
here the doughters are wisible not inside mommy but aside/beside momy
(and probably down the branch)
foo a,b,c, tab[10];
| Sysop: | Tetrazocine |
|---|---|
| Location: | Melbourne, VIC, Australia |
| Users: | 8 |
| Nodes: | 8 (0 / 8) |
| Uptime: | 14:38:29 |
| Calls: | 220 |
| Files: | 21,513 |
| Messages: | 83,058 |