Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C with Lambdas and Closures

Name: Anonymous 2013-07-16 19:11

Best of both worlds or horrible abomination?

Name: Anonymous 2013-07-16 19:12

C#.

Name: Anonymous 2013-07-16 19:16

>>2
Addendum: C with Lambdas and Closures, but without trying to be Java, no forced dotNET shit, no VM, and no OO trash.

Name: Anonymous 2013-07-16 19:18

>>3
Oh, ok.  C#.

Name: Going to sleep now 2013-07-16 19:24

Name: Anonymous 2013-07-16 19:27

>>5
Can I sleep with you? we could cuddle a bit ;)

Name: Anonymous 2013-07-16 21:30

>>6
I wanna put my car in your cdr

Name: Anonymous 2013-07-16 22:08

>>7
I wanna rip your dvd.

Name: Anonymous 2013-07-16 22:51

There've been one or two instances where I thought a lambda in C might be useful. In general, however, any operation that requires a lambda is better suited for higher level language anyway.

Name: Anonymous 2013-07-17 0:14

Just use C++11. Use it as a C with lambdas and closures.

Name: Anonymous 2013-07-17 0:25

>>10
Unsupported by any relevant compiler.

Name: Anonymous 2013-07-17 1:12

>>11
Yes, but that's not a TRUE scotsman.

Name: Anonymous 2013-07-17 1:18

Use D. Or Rust, if you like immature languages.

Name: Anonymous 2013-07-17 1:27

Rust on Rails

Name: Anonymous 2013-07-17 1:59

rusty rails can cause a train to go off track and cause massive destruction

Name: Anonymous 2013-07-17 3:55

>>14,15
Someone needs to make a rails equivalent library for Rust just so we can have this pun.

Name: Anonymous 2013-07-17 4:02

>>11
Wrong GCC has supported them since 4.5. Clang/LLVM has supported them since 3.1. MSVC++ has supported them since MSVC++ 2010. Intel C++ has supported them since Intel C++ 10.0.

Name: Anonymous 2013-07-17 8:47

>>6
Fine, but you have to bring your own bed. I only have an airbed. Better be DDF. Here is my location:
https://maps.google.com/maps?q=200%20West%20St,%20New%20York,%20NY%2010282

Name: Anonymous 2013-07-17 9:40

>>11
If you download the latest Clang binaries and compile the latest clang libc++ (easy to do), you can have pretty much ~100% of C++11 compatibility. I have it running right now on a Linux box while using STROUSTRUP C++11 book.

The GCC compiler is C++11 compatible itself but the GNU's libstdc++ is still far away from clang libc++. And I've heard that Visual C++ supports it ~100% too.

Name: Anonymous 2013-07-17 9:46

>>19
LLVM is Jew shit. Use only native code.

Name: Anonymous 2013-07-17 10:06

>>20
LLVM bytecode is only used as a intermediate step. My binaries are full native.

Clang is the superior compiler.

Name: Anonymous 2013-07-17 10:35

>>21
How is it coming along now? Do you know if it will compile a modern GNU+Linux system? Last time I tried compiling GNU and Linux using Clang six years ago, it didn't work completely.

Name: Anonymous 2013-07-17 10:38

>>22
http://sylvestre.ledru.info/blog/2013/02/06/rebuild_of_debian_using_clang_3_2
The percentage of failure is the same as clang 3.1: 12.1% of failure. That means that on 18264 packages, 2204 failed to be built with clang (it was 17710/2137 with the version 3.1).

Name: Anonymous 2013-07-17 10:43

>>22
This is the latest news I can find about the Linux kernel with clang: http://www.phoronix.com/scan.php?page=news_item&px=MTM1NDY

The userland should compile fine, unless they're using obscure GCC extensions.

Name: Anonymous 2013-07-17 10:48

Clang is 12% failure.

Name: Anonymous 2013-07-17 10:59

Hello hackernews

http://libcello.org/

Name: Anonymous 2013-07-17 12:31

Name: Anonymous 2013-07-17 16:52

Because no GC or memory safety.
typedef int top;
int *yolo() {
  top lel;
  return &lel; /* because YOLO xD */
}

Name: Anonymous 2013-07-18 2:05

>>26
nigger rigging was never good.

Name: Anonymous 2013-07-18 2:13

>>26
Cello projects is inspired by Haskell
It much closer resembles the design of the Go or Haskell standard libraries.

love how this retard says "Haskell" like it is some magic word

Name: Anonymous 2013-07-18 6:10

>>3
Oh, ok.  C#.

Name: Anonymous 2013-07-18 7:47

>>30っぱい is projecting

Name: Anonymous 2013-07-18 10:11

Clojure is just syntatic sugar. See these examples that do the same:

Ruby

a = [1, 2]
b = "hello"
f = lambda do
  a << 42
  puts b
end
f.()
# a is not [1, 2, 42], "hello" is printed


C

struct State_1
{
  int** a;
  int* a_end;
  const char** b;
};

void f(const struct State_1* state)
{
  (*state->a)[state->a_end] = 42;
  (*a_end)++;
  puts(*state->b);
}

int main()
{
  State_1 s1;
  int a[256];
  int a_end = 0;
  const char* b = "hello";

  a[a_end++] = 1;
  a[a_end++] = 2;

  s1.a = &a;
  s1.a_end = &a_end;
  s1.b = &b;

  return 0;
}


These do exactly the same thing. The real difference is that C does it about 120 times faster.

In terms of code length, Ruby is slightly better. However, considering performance issues, it's hardly worth it. In real world, typing those extra letters takes practically zero time compared to the time that is spent designing higher level structures.

To answer to your question: I don't think it would be horrible abomination. However, I thing it closures are not needed in C. They bring more float to a language that is right now simple and elegant.

If you want lambdas so desperately, go try C++11. Let's see how happy you are then. HAH. Enjoy your bloat.

Name: >>33 2013-07-18 10:13

>>33
Sorry i was tired when writing that. C-version won't work, but you get the point.

Name: Anonymous 2013-07-18 11:03

Clojure is JVM cancer!

Name: Anonymous 2013-07-18 11:32

  int** a;
  int* a_end;
  const char** b;
void f(const struct State_1* state)
  const char* b = "hello";

Faggot!

Name: Anonymous 2013-07-18 13:59

>>33
In real world, typing those extra letters takes practically zero time compared to the time that is spent designing higher level structures.
Using a proper text editor (such as ed or emacs), it does not take much time at all to type this sort of stuff out (abbrevations et cetera).

Typed with emacs

Name: Anonymous 2013-07-18 22:59

>>37
Well, emacs is ok. In some cases it's even better than ed. But it's not standard. So I think it's just better to use ed.

Ed is the standard text editor.

Name: Anonymous 2013-07-18 23:00

>>36
/polecat kebabs/

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List