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

Language Ideas

Name: Anonymous 2009-10-04 20:40

do you guys ever have ideas for features in programming languages that you have never seen implemented but would like to?
i'm sure some of you have. i can't be the only one.
share them here.
i'll start with an idea i had a little while ago; i wouldn't be surprised if some language such as perl had already thought of it though.

have you ever been stuck writing long if statements along the lines of: if(c == x || c == y || c == z)?
sure, it might not look so bad in this case since it's rather short. but what if you could abbreviate it?
something like: if(c == ||(x,y,z)), or perhaps if(c == (x || y || z)), or even if((x,y,z)||==(a,b,c)), which would expand to if(x == a || y == b || z == c).
wouldn't that be a nice little time saver?

Name: Anonymous 2009-10-04 20:44

you could extend this using arrays.
i'll use perl notation in the example because it clearly differentiates arrays from scalars.
if($c == ||(@array1)), expanding to if($c == $array1[0] || $c == $array1[1] || ... || $c == $array1[n])

Name: Anonymous 2009-10-04 20:50

macros plus

Name: Anonymous 2009-10-04 20:53

>__> ... <__< ... Are you trolling me, mister? >w<
if c in (x, y, z):
  v(-.-)v

HTH. ^__^

Name: Anonymous 2009-10-04 20:56

>>3
Lisp, trolling other people's languages since 1958

Name: Anonymous 2009-10-04 20:57

>>4
oh, god.
what the hell is this?

Name: Anonymous 2009-10-04 21:04

>>6
Looks like some PYTHON to me.

Name: Anonymous 2009-10-05 1:19

>>1
have you ever been stuck writing long if statements along the lines of: if(c == x || c == y || c == z)?
Actually, I haven't. Maybe you need to put together a decision table and refactor your conditionals.

Name: Anonymous 2009-10-05 2:46

>>8
well how about:
if(x == true || y == true  || z == true )
then?
or if(x == true  && y == true  && z == true)
commonly seen in many languages with boolean type values

Name: Anonymous 2009-10-05 2:52

>>9
Not really. I might go two wide, but not often three.

Name: Anonymous 2009-10-05 3:23

>>10
Yeah? Well hax my anus, buddy!

Name: Anonymous 2009-10-05 4:09

>>8
This man is a REAL/PROGRAMMER

Name: Anonymous 2009-10-05 5:55

>>8
I write my conditionals however is the clearest to read and let the synthesizer worry about refactoring them.

Name: Anonymous 2009-10-05 15:37

doesnt ruby support this

Name: Anonymous 2009-10-05 15:39

>>14
Probably, but it'd be SLOW AS FUCK™

Name: Anonymous 2009-10-05 15:53

The slow as fuck way in Perl:
use Quantum::Superpositions;
if ($c == any($x, $y, $z))
...

Name: Anonymous 2009-10-05 22:22

>do you guys ever have ideas for features in programming languages that you have never seen implemented but would like to?

Nope I use Lisp so I just make them.

Name: Anonymous 2009-10-05 22:34

>>17
Lispers = the programming worlds equivalent to deluded Apple fanatics
nobody cares about your toy language.

Name: Anonymous 2009-10-05 22:36

>>18
Would a toy language be able to write as many parens in one line as you write in a whole C program?  Now who has the fucking toy language?

Name: Anonymous 2009-10-05 22:38

>>19
yes. that's exactly the kind of thing toy languages are created for.

Name: Anonymous 2009-10-05 23:08

>>1
elem or zipWith (==) or all (==a) or whatever the hell you want

Name: Anonymous 2009-10-06 0:48

forget it, its NP-complete

Name: Anonymous 2009-10-06 3:14

>>18
Somebody's mad that their obsolete-before-it-was-designed language doesn't live up to Lisp's example.

Name: Anonymous 2009-10-06 3:35

>>1
have you ever been stuck writing long if statements along the lines of: if(c == x || c == y || c == z)?
Use switch for superior performance: switch(c)
  {
    case x:
    case y:
    case z:
      /* whatever */
  }

Name: Anonymous 2009-10-06 7:03

>>24
Use macros for superior readability!

switch (c) {
    case x, y, z:
        /* whatever */
}

Oh wait, you can't do that because C doesn't support meta-programming! lol!

Name: Anonymous 2009-10-06 7:08

>>25
does not understand the purpose of C

Name: Anonymous 2009-10-06 9:11

>>26
On the contrary, I do. I was hoping for some pro-C fag to jump in and argue.

Name: Anonymous 2009-10-06 9:33

>>27
I expect C to be C, a portable assembler where you can (mostly) predict the performance of your program.
There are high-level languages which support meta-programming(and of those that I can think of (Lisp and SEPPLES), both have implementation-dependent ways which support low-level stuff when needed), but that's their purpose, it's not C's purpose.

Name: Anonymous 2009-10-06 12:44

>>27
Here's a tip, boy: never show your hand like that. This is /prog/. Counter-metatrolls trolling metatrolls trolling trolls and FV trolling everyone. Don't ever forget it.!

Name: Anonymous 2009-10-06 13:18

>>28
comparing lisp to sepples
void go_die_in_a_fire()
{
    free prog;
}

Name: Anonymous 2009-10-06 13:49

>>30
// Dereferencing free'd memory for maximum profit
*prog = *prog;

Name: Anonymous 2009-10-06 13:59

>>26
Thinks the purpose of C is to be awkward and difficult to use.
A language like C needs decent macros.

Name: Anonymous 2009-10-06 14:14

C's macros are decent the way they are.

Name: Anonymous 2009-10-06 14:22

>>33
( ≖‿≖)

Name: Anonymous 2009-10-06 14:23

>>1
You might be surprised, but there is a language that does that and then some more:
IF SALARY > 9000 OR SUPERVISOR-SALARY OR = PREV-SALARY
I leave the conclusions as an exercise for the reader.

Name: Anonymous 2009-10-06 14:30

>>35
Why hello there, UMH memesmith-chan

Name: Anonymous 2009-10-06 14:47

>>35
9000

Back to /b/, please

Name: Anonymous 2009-10-06 15:09

>>33
C's macros are barely useful. Retarded templates based on textual (!) substitution. If C macros could actually generate code, C would be much more usable.

Name: Anonymous 2009-10-06 15:10

I would like to see an interpreter that allows me to export my defined functions at the end of a REPL session (or whenever) instead of having to edit the file in my editor and then have to keep reloading it in the interpreter. Bpython comes close, in that it exports all the commands and comments out the replies, but I'd rather the functionality was built into the interpreter rather than having to run a script on the saved session to extract only the final function bindings. I'll probably add it to my own scheme interpreter if I ever stop being a lazy bastard.

Name: Anonymous 2009-10-06 15:23

>>39
Are we talking about Python here? Because any decent Lisp editor will let you send functions right from your file to your Lisp.

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