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

Pages: 1-4041-

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.

Name: Anonymous 2009-10-06 15:28

>>40
I was talking about Python there, but which Lisp editors are you referring to?

Name: Anonymous 2009-10-06 15:35

>>38
They can, but it's painful.

Name: Anonymous 2009-10-06 15:56

>>37
I copied that line straight from the www.Wikipedia.org world wide web sight.

Since I, unlike some people, visit /b/ approximately one and a half times per year, and, unlike some people, do not feel insecure at the thought that some people might think otherwise, and, finally, since I barely registered this reference to a so-called «Meme», I had not felt a slightest desire to alter the number.

Name: Anonymous 2009-10-06 16:10

>>41
All of them, I'd think. Slime, the Lispworks IDE, ABLE... I obviously don't need to mess with any of them but Slime.

Name: Anonymous 2009-10-06 18:15

>>44
drscheme

Name: Anonymous 2009-10-06 18:55

>>44
Hmm, M-x slime-edit-definition seems to be roughly what I'm after. Does it require me to stop and restart the interpreter? or can I immediately start working with the new definitions?
>>45
DrScheme is what I've been using (or occasionally running and inferior scheme with quack-mode) and it's explicit stop-and-run is no better that having to use reload in python although it is more convenient.

Name: Anonymous 2009-10-06 23:37

>>46
DrScheme is what I've been using and it's explicit stop-and-run is no better that having to use reload in python although it is more convenient.
? You don't have to type in the definitions area. Just ctrl+d and the repl loop is yours to do with as you please, including save. Save interactions as...

Name: Anonymous 2009-10-07 4:30

>>47
I hadn't noticed that feature, but it just saves all the interactions(much like bpython or idle would for python) and misses the point of my original rant. Which is, "Why should I have to write a separate script to process my interactions, when my interpreter has all the bindings information built in?"

Name: Anonymous 2009-10-07 5:29

>>48
Enjoy your expanded macros.

Name: Anonymous 2009-10-07 10:47

>>46
interpreter
Lol.

More likely you're looking for slime-compile-defun (C-c C-c). M-. — slime-edit-definition — is useful, but it's more of a cross-referencing tool. You just put the cursor on a top-level form and press C-c C-c, and your new code is compiled and ready to go. It's not exactly a REPL dump, but I'd rather type my code in a file to begin with so I can organize it.

Name: Anonymous 2009-10-07 11:12

>>50
It's not that I don't separate my code into files, but it's not unusual for me to just spend a lot of time just tweaking things and then having to copy+paste code from my REPL and I would rather my tools took care of this than having to keep interrupting my workflow. Thanks though, I'll need to investigate SLIME further.

Name: Anonymous 2009-10-07 21:14

>>51
Right, that's what I thought you wanted. Most tools, you can just C-c C-c a definition (or whatever key) and it's sent straight to the Lisp, no cut/paste bullshit. Use a file for a scratch area instead of the REPL, and you're good to go.

Name: Anonymous 2009-10-07 21:19

Who the hell programs in an REPL loop?

Name: Anonymous 2009-10-07 21:30

>>53
Read Eval Print Loop loop
Loop loop loop? Loop loop loop.

Name: Anonymous 2009-10-07 21:58

>>54
you have been loop'd

Name: Anonymous 2009-10-07 22:27

>>55
You loop me right round, baby, right round.  Like a REPL loop, right round right round.

Name: Anonymous 2009-10-08 3:35

>>35
hey, that's actually pretty cool.
fuckyeah, COBOL

Name: Anonymous 2009-10-08 3:40

>>30
I see that someone needs to read their K&R again.

Name: Anonymous 2009-10-08 4:07

Perl now supports this using the Swiss army knife operator (~~).

Name: Anonymous 2009-10-08 5:09

Name: Anonymous 2009-10-08 5:21

>>50-53
I write most of my code in a file, and send it to the REPL using the appropirate SLIME commands. I switch to the REPL when I want to test functionality of newly written code or write any throw-away code.

Name: Anonymous 2009-10-08 18:59

>>61
But that is how Haskells do it. Haskells are not a real programmer !!

Name: Anonymous 2009-10-08 19:01

>>62
s/haskell/Lisp/ig;

Name: Anonymous 2009-10-08 19:09

The REPL is there for newcomers to learn the language.  If you are programming in the REPL, you are a fucking idiot and should feel kind of bad about it :(

Name: Anonymous 2009-10-08 19:21

>>64
2.5/10

Name: Anonymous 2009-10-08 19:25

>>65
Don't feel bad, I'm sure there's a handful of people that do it.

Name: Anonymous 2009-10-08 19:47

>>62
I can and do use whole project(just load up and compile the ASDF system) compilation when starting up my image. I compile individual definitions or run them as required, this is smarter and faster than just reloading and recompiling everything.
>>64
Programming, no. Testing/experimenting throw-away code, yes.
There is no reason to write code at the REPL that you're going to throw away. Some people may prefer copying REPL transcripts to a file, but I find it too messy for my own tastes.

In most implementations, you interact with the live image  through the REPL, even if you don't realize it. Even if all you do is a couple of COMPILE/LOAD/COMPILE-FILE (SLIME and/or ASDF will do it for you transparently). In the end it doesn't really matter, if you have a better way to interact with your image, you just do it.

Name: Anonymous 2010-12-10 9:46

Name: Anonymous 2010-12-27 17:45

Name: Anonymous 2011-02-04 18:04


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