#1
  1. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,070
    Rep Power
    9398

    Programming language wishlist


    Short version: What features would you want to see in a programming language? Anything goes.


    Long version:
    I'm developing a programming language and I'm looking for ideas for its capabilities. I don't mean what libraries and such it includes but actual features of the language itself. For instance, .NET's Attributes, Perl/JavaScript's inline regular expressions, and closures/anonymous functions. Things that are provided by the syntax of the language.

    Examples:
    - Multiple inheritance (dramatic music here)
    - Arbitrary number bases. Traditionally there's suffixes like 0x for hex, 0b for binary, and 0 for octal. How about others? Limited to 2-36, no fractional component.
    Code:
    two = 10#2;
    eight = 11#7;
    twentyfive = 221#3;
    - Exponentiation. A surprising number of languages don't have an exponent ("to the power of") operator. It's often denoted with ^ or **.
    Code:
    x = 2 ** 3; // 8
    - An n-ary operator. Like a ternary with an arbitrary number of conditions and true-values, or an inline switch.
    Code:
    y = ?{ x < 8: 1, x == 8: 2, x > 8: 3 }; //  2
    - Optionally allowing inline HTML, which is simply an example of an extensible grammar. Yes. A grammar that changes. At runtime. It's crazy, I know. There will be some limitations that I'm still working on, such as enforcing valid XHTML in code.
    Code:
    html = <p class="tip">A &lt;b&gt; tag makes things <b>bold</b></p>;
    So the question I pose to you all is this: With your vast programming experience, what kinds of features have you liked most? Disliked? Wanted to see? Or if you wanted to make one yourself (and had the time and money), what ideas could I steal from yours?
    The syntax is similar to C/et al. so if you have an example just type up something quick. The language will be interpreted which means I can do damn well near whatever I want. The parser also supports ambiguous syntaxes* as long as one of them eventually succeeds and the others fail.


    Currently I want to include some kind of automated testing mechanism. Instead of deriving from classes or marking something with attributes, a way of indicating tests to run inside the actual code you're writing.
    Code:
    function example(int x)
        [test (-123) == 123]
        [test (0) == 99]
        [test (123) == 246]
    {
        if (x < 0) {
            return -x;
        } else if (x == 0) {
            return 99;
        } else {
            return 2*x;
        }
    }
    That looks nice enough, but I'd really like something inside the body - like right next to the statements to test. However []s and {}s are already used for lists and associative arrays so I can't use those...


    * For instance, an initial "foo" is ambiguous because it could be a name or a number with a base. Ultimately it will be the one (like "foo.bar" as a member expression) the other ("foo#36") or perhaps neither (invalid, parser dies) but it can't be both.
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,625
    Rep Power
    4247
    How about a probabilistic goto a la the Kvikkalkul programming language
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. Eager to learn
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2009
    Location
    Maryland, USA
    Posts
    2,230
    Rep Power
    2179
    I like PHP string literals (echo "foo is $foo".

    I personally find it annoying to do (for example Java)

    String world = "world";
    System.out.println("hello " + world + ", how are you?");

    Maybe there already is a better way, but I personally find it annoying
    "Quality of responses may vary. I reserve the right to change my mind for any reason what-so-ever without admitting I was wrong. I'd prefer to change your mind however, it's easier on my ego". - jwdonahue

    "so no-one has actually bothered to post an original quote ? what's wrong with making up your own?"
    - marnixR
  6. #4
  7. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    Replying to this thread is on my todo list. I just don't have time at the moment to devote sufficient thought to a good reply.

    Comments on this post

    • ManiacDan agrees
    • Skipt agrees
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  8. #5
  9. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    I'm w/ E-Oreo on this one... I could write an enormous reply to this thread

    But, here's a quickie: I work primarily with enterprise customers (think Global 2000 companies and governmental agencies). The vast majority of them have either Java or .NET installed in production. Any time you bring up running an app that isn't Java or .NET, the first question is - will it run on the JVM or .NET framework? If the answer is no, you're out of luck; if the answer is yes, you at least have a fighting chance.

    So, if you're serious about writing a new language, it has to be able to both run independently, as well as have a way to run it on either the JVM or .NET framework (preferably the JVM).
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  10. #6
  11. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,070
    Rep Power
    9398
    Originally Posted by drgroove
    But, here's a quickie: I work primarily with enterprise customers (think Global 2000 companies and governmental agencies). The vast majority of them have either Java or .NET installed in production. Any time you bring up running an app that isn't Java or .NET, the first question is - will it run on the JVM or .NET framework? If the answer is no, you're out of luck; if the answer is yes, you at least have a fighting chance.
    I'll look into working with Java, but the interpreter/et al. is in .NET (at least for the foreseeable future) so that'll work. I'll pay more attention to exposing interfaces and such.


    And a brief update from the last week of thinking about it. I'm turning the language into an extension to a generic parser/interpreter engine, which would lay the groundwork for handling any precise grammar. So you could write an extension for C# or Lisp code, or create your own language (perhaps tailored to a specific problem domain). You could even turn it into an actual compiler if you wanted: your extension defines the grammar and the parser basically hands you back syntax trees. You could also build on top of other languages, such as adding inline HTML to something (providing it doesn't conflict with the original syntax).

    So for a number of reasons, including "because I can do it better " and "I need something to test the engine", I'm making my own language. And if I'm going to do that I might as well make it as useful as I can, borrowing ideas from some places and avoiding pitfalls in others, and rather than learn a whole bunch of languages I figure I'll outsource the answers.
  12. #7
  13. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,186
    Rep Power
    2265
    Right on dude. Can't wait to take the new lang for a test drive

    Comments on this post

    • requinix agrees : it'll be a while, but thanks for the vote of confidence
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  14. #8
  15. Lord of Dorkness
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2004
    Location
    Central New York. Texan via Arizona, out of his element!
    Posts
    8,524
    Rep Power
    3314
    One can write a new language or one can use what they have. The one that I wrote never took off and it severely restricted my caloric intake for a couple years. Just sayin'.
    Functionality rules and clarity matters; if you can work a little elegance in there, you're stylin'.
    If you can't spell "u", "ur", and "ne1", why would I hire you? 300 baud modem? Forget I mentioned it.
    DaWei on Pointers Politically Incorrect.
  16. #9
  17. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    this guy made a language recently and posted it to devshed. Interesting syntax.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  18. #10
  19. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Posts
    75
    Rep Power
    58
    in php, you can do
    header("location: somepage");

    which does a GET request

    i want to have a way in php to make a POST request
  20. #11
  21. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    POST data follows header redirects.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo