@ramin_hal9001
#ecl #commonLisp is like this:

(defun foo ()
(let ((my-int 0))
(declare (:int my-int))
(ffi:c-progn (my-int)
"int *x;"
"for (x = &#0;*x<5;)" (incf my-int)
(format t "~d" my-int))
my-int))

must go through COMPILE-FILE.

@ramin_hal9001 the (c-progn (thing1 thing2 thing3)) are written as #0, #1, #2 in the C/C++ and by their variables names in lisp, and must be declared as a type ecl's sffi knows about. If libecl was compiled with a C++ compiler, c-progn does C++, if C, it does that C.

@ramin_hal9001 in case this was not ostentatious enough, a small variation:

(defun foo% ()
(let ((my-int 0))
(declare (:int my-int))
(ffi:c-progn (my-int)
"int *x;"
"for (x = &#0;*x<5; (" (incf my-int) "))" ";"
(format t "~d" my-int))
my-int))

The extra "(" ")" is necessary because of operator priority I guess.

@screwlisp @ramin_hal9001

This reminds me of HTML/PL, my self-created programming language that uses HTML tags and self-modification as an alternative to JavaScript...

@wakame @screwlisp the way it can paste C++ code right into the file it emits reminds me of is the C preprocessor, if it were a Lisp. It is like the inventor of ECL thought, “I’ll invent a better C preprocessor that is actually a Lisp,” and then eventually decided to make it conform to the Common Lisp specification.

@ramin_hal9001
@jackdaniel how do you normally describe ECL's mechanism using the system C / C++ compiler?

@wakame