

Functional C Programming  (Or, why God, why?) - cioc
https://github.com/cioc/functionalC

======
danneu
You should remove the deprecating remarks from your readme/code/headline.

Someone will tweet them for you.

------
thewarrior
Providing a few macros to add some syntactic sugar could make this much better
. On a separate note , theres no need for any self deprecation . I being a
beginner found this post quite thoughtful and interesting .Keep going.

~~~
cioc
yes, we need macros, more macros. Then it will be good.

In all seriousness though, it's basically supposed to teach about function
pointers.

I would never, ever recommend programming like this.

In response to the macros, i think that would make the program particularly
hard to reason about because part of the program would be rewritten at compile
time.

I would discourage the use of macros. I believe that Brian Kernighan would
agree with me.

As a rule of thumb, it is better to use enums over #defines and avoid macros
like death. Stick to the most standard, simple parts of the language and your
programs will be most readable and likely elegant.

~~~
mtdewcmu
>> "Avoid macros like death"

Macros are arguably one of the most standard and simplest parts of C. They are
much more dependable than, say, gcc inline functions (in my experience). Just
don't try to do bizarre things with them. Study how the best C programmers use
them, and imitate.

------
bmh100
Carmack mentioned moving to functional C++ programming recently.
[http://www.altdevblogaday.com/2012/04/26/functional-
programm...](http://www.altdevblogaday.com/2012/04/26/functional-programming-
in-c/)

Perhaps you are onto something here.

------
warmwaffles
Yes, finally a way for me to have more unreadable C code.

~~~
venomsnake
You have had a way to write unreadable C for more than 20 year ... its called
C++.

~~~
mtdewcmu
That's presumably why he/she is glad this adds a new way in C. Making c++
unreadble is child's play -- anyone can do it.

------
mtdewcmu
No, I never wanted to write C that way. That looks too much like C++, with its
std::for_each and things that look potentially useful, until you actually try
finding a use for them.

What I have wanted is closures that you can stick data inside. But they can't
be done in a reasonable way in a language like C. The C++ version falls short
of usefulness.

~~~
pohl
<http://lambda-the-ultimate.org/node/3593>

~~~
pohl
I should have shared this link instead...

<http://en.wikipedia.org/wiki/Blocks_(C_language_extension)>

------
seagaia
Can you make this into a ruby gem?

------
joshguthrie
This is beautiful.

~~~
toolslive
eye of the beholder.

