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

Replacing C/C++ with LISP.

Name: Anonymous 2013-08-01 2:32

Consider the following way to use Common Lisp in place of C/C++, without any custom reader macros:

(to main int:arg char:argv
  ! printf "Hello, World!"
  ! return 0
  )


I.e. packages take role of builtin types and structs, also containing definition for overloadable `+` and `-` and template generics, so a compiler could be implemented without much fuzz, using already present Common Lisp framework.

It would also look much clearer than standard C/C++:
int main(int argc, char **argv) {
  printf ("Hello, World!");
  return 0;
}

Name: Anonymous 2013-08-01 2:35

>>1
to main int:arg char:''argv
self fix.

the quotes would be usable for pointers and dereferencing, because low level code doesn't work with sexps.

Name: Anonymous 2013-08-01 2:41

Consider this:
http://is.gd/zd4I9p

Name: Anonymous 2013-08-01 2:54

>>1
bigloo has type signatures like that. I think defmethod style signatures are better, since you can write lisp style macros that expand to them.

Name: Anonymous 2013-08-01 2:59

>>4
defmethod style signatures are better, since you can write lisp style macros that expand to them.
typename:varname dont impede macros. Moreover, they provide strong typing with (intern varname "typename") being constructor, while symbol-package and symbol-string are accessors.

Name: Anonymous 2013-08-01 3:08

>>5
The power of lisp macros comes from every element of its syntax being parsable as a tree data structure. If this syntax sugar was allowed, how would macros expand to it, and would you be able to pass the variable:type form as arguments to macros that expanded to function definitions?

Name: >>6 2013-08-01 3:14

and more importantly, would macros be able to inspect the variable:type form using accessor methods?

Name: Anonymous 2013-08-01 3:18

And because compiler knows types, we can reuse function application for array indexing, so a[i][j] would be (a i j). '=' would be declaration and ':=' (pascal style) setf. Resulting code would be no less readable than the original C/C++ version:
(to 'char:basename 'char:name
  ! long:i = - (strlen name) 1
  ! while (and (!= (name i) #\/) (> i 0))
     dec i
  ! when (== i 0) return ""
  ! name i := 0
  ! return name
  )


char *basename( char *name ) {
   long i;

   for( i = strlen( name ) - 1; (name[ i ] != '/') && (i > 0); i-- );

   if( i == 0 )
      return "";
   else {
      name[ i ] = 0;
      return name;
   }
}

Name: Anonymous 2013-08-01 3:19

>>6>>7
by using symbol-name and symbol-package.

Name: Anonymous 2013-08-01 3:22

>>8
It would be also nice to add string constructor sugar, which would automagically expand "point = ([x],[y])" into `sprintf tmpbuf "point = (%d,%d)" x y`. It would save so many keystrokes!

Name: Anonymous 2013-08-01 3:59

hey nikita, you are so smart. would you like to lose your virginity to me? i'm a girl btw <3 :3

Name: Anonymous 2013-08-01 4:22

>>11
I'm not smart and I'm not gay.

Name: Anonymous 2013-08-01 4:27

>>12
you wont know until you try it ;)

Name: Anonymous 2013-08-01 5:17

>>12
have you ever masturbated with a finger up your ass? It feels glorious.

Name: Anonymous 2013-08-01 5:17

>>12
i'm not smart
Of course, you are an irrational nutter who hates Jews.

Name: Anonymous 2013-08-01 5:30

Of course, you are an irrational number who hates Roots.

Name: Anonymous 2013-08-01 5:36

>>14
>finger up your ass
disgusting, enjoy your finger full of poops

[spoiler]how can i use quotes [i]please!?[i][/spoiler]

Name: Anonymous 2013-08-01 5:38

>>17
feels very good, you should try it at least once.

Name: Anonymous 2013-08-01 5:41

>>18
maybe i will try some day with condom on my finger

Name: Anonymous 2013-08-01 6:32

>>19
the orgasm is much more intense. do it now, i recommend it.

Name: Anonymous 2013-08-01 6:49

>>17
You must reach satori first. You also need to be circumcized

Name: Anonymous 2013-08-01 6:51

>>21
You must reach satori first
i did

You also need to be circumcized
i am

Name: Anonymous 2013-08-01 6:56

check 'em

Name: Anonymous 2013-08-01 6:56

>>22
o.O

Name: Anonymous 2013-08-01 6:57

Jewified dicks have so little feeling you have to stick fingers up your ass.

Name: Anonymous 2013-08-01 7:13

>>25
I am not jew

Name: Anonymous 2013-08-01 7:45

>>7
typename:varname transparently solves major compiler micromanagement problem with well known tools, so that all type info would be available to user and READ would refuse to accept undefined types, while still allowing forward declarations.

Name: Anonymous 2013-08-01 8:02

Accessing struct fields could also be done with apply notation: (file buffer length) instead of file.buffer.length

Name: Anonymous 2013-08-01 9:23

ACCESS MY ANUS

Name: SuperGoy3015 2013-08-01 11:18

JEWS

Name: SuperGoy3015 2013-08-01 11:20

JEWS

Name: SuperGoy3015 2013-08-01 11:41

JEWS

Name: SuperGoy3015 2013-08-01 11:41

JEWS

Name: SuperGoy3015 2013-08-01 11:41

JEWS

Name: SuperGoy3015 2013-08-01 11:42

JEWS

Name: /prog/ police 2013-08-01 11:46

JEWS

Name: /prog/ police 2013-08-01 11:46

JEWS

Name: ANDRU 2013-08-01 11:52



    PENIS ARE HARD

Name: Anonymous 2013-08-01 15:03

My code doesnt compile!

  failed AVER: (NULL CURRENT)
This is probably a bug in SBCL itself. (Alternatively, SBCL
might have been corrupted by bad user code, e.g. by an undefined
Lisp operation like (FMAKUNBOUND 'COMPILE), or by stray pointers
from alien code or from unsafe Lisp code; or there might be a
bug in the OS or hardware that SBCL is running on.) If it seems
to be a bug in SBCL itself, the maintainers would like to know
about it. Bug reports are welcome on the SBCL mailing lists,
which you can find at <http://sbcl.sourceforge.net/>;.
   [Condition of type SB-INT:BUG]

Name: Anonymous 2013-08-01 15:34

>>39
That is some crazy bug. It fails on (match 123 ((= x (not (x ! oddp x))) (list 'hello x)))

but it works when I macroexapand it to:

(LET ((G996 123))
  (BLOCK G997
    (TAGBODY
      (LET ((X G996))
        (LET ((G999 G996))
          (BLOCK G1000
            (TAGBODY
              (LET ((X G999))
                (IF (ODDP X)
                    (RETURN-FROM G1000 (PROGN (GO G998)))
                    (GO G1002)))
             G1002
              (RETURN-FROM G1000
                (PROGN (RETURN-FROM G997 (PROGN (LIST 'HELLO X)))))
             G1001))))
     G998)))

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