fir
2024-09-01 14:15:37 UTC
i tried to "design" well a function definition
and meed terrible stall i would say in thsi - dont know how to
do it though i think few years on this
(the probl;ematic is especially this returned values part)
as its go so hard i began to think if this paradigm of calls is not just
wrong and some somewhat new idea come to me (though partially i was
thinking on it)
in fact i fint annoying this form
int x = foo()
annoying is especially this "=" sign as this is not quite assignment imo
other annoying think is thet you need to define x at all
and maybe this is a problem or its part
instead of
int x = add(2,3)
print(x)
maybe it should be
add(2,3)
print(add)
i mean the function name without the () should just represent the
return value so you no need to asign it
present c allows print(add(2,3))
but disalows to reuste it (and assign etc/et more
im close to think it definitely should
i mean
strlen("sjsbsjbhs"")
printf("%d", strlen)
obviously some names could maybe not fit like
find_character_position(txt, 'x');
print(find_character_position);
it should be moer lieke "found"
but i think it could be resolved by allowing to define this
int found find_character_position(char* txt, char c);
{
//...
// or return int found; //something liek that liek defining
structure neme
}
then this found name should be avaliable to caller
so
find_character_position(txt, 'x');
if(found>=0)....
or
sumarize(2,3,3,2,2,3)
if(sum<10) ...
those function call asigments are probably some kind pf mistake
(though it looks a bit weird not to do that)
and meed terrible stall i would say in thsi - dont know how to
do it though i think few years on this
(the probl;ematic is especially this returned values part)
as its go so hard i began to think if this paradigm of calls is not just
wrong and some somewhat new idea come to me (though partially i was
thinking on it)
in fact i fint annoying this form
int x = foo()
annoying is especially this "=" sign as this is not quite assignment imo
other annoying think is thet you need to define x at all
and maybe this is a problem or its part
instead of
int x = add(2,3)
print(x)
maybe it should be
add(2,3)
print(add)
i mean the function name without the () should just represent the
return value so you no need to asign it
present c allows print(add(2,3))
but disalows to reuste it (and assign etc/et more
im close to think it definitely should
i mean
strlen("sjsbsjbhs"")
printf("%d", strlen)
obviously some names could maybe not fit like
find_character_position(txt, 'x');
print(find_character_position);
it should be moer lieke "found"
but i think it could be resolved by allowing to define this
int found find_character_position(char* txt, char c);
{
//...
// or return int found; //something liek that liek defining
structure neme
}
then this found name should be avaliable to caller
so
find_character_position(txt, 'x');
if(found>=0)....
or
sumarize(2,3,3,2,2,3)
if(sum<10) ...
those function call asigments are probably some kind pf mistake
(though it looks a bit weird not to do that)