Thread: Good (scripting) languages for web

  1. #1
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654

    Good (scripting) languages for web

    I have been researching of late... having to have had use "bad" languages such as Java.
    Basically, what I want to ask is if there is any language for the web that simplifies resource management similar to RAII?
    By that I mean languages that don't force you to use some kind of try/catch/finally everywhere an exception might be thrown in order to force some resource closed (such as Java).

    For example, say I have a database which needs to be closed, and some in between opening it.
    Is there a mechanism in PHP/Perl/ASP/<name_your_language> to make sure the database always gets closed regardless if exceptions are thrown or not, without having to retort to some petty try/finally solution?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I always opt for Python, but that's my preference.

    It does use the try/finally scheme, but also uses the "with" resource block system (Understanding Python's "with"..statement) that most dbapi interfaces adhere to

    As well as that it has a pretty good posix interface, nice C++ interfacing with the Python API, SWIG or Boost and it works well in most circumstances (COM on Windows, Web programming, shell programming on linux.....etc)

    RAII is a _very_ nice scheme to use, but apart from C++, it doesn't seem that popular amongst popular languages

  3. #3
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Ah, never mind, Fordy got there first.

    Soma

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Why raii is hated outside the c++ world is beyond me. It has only advantages over garbage collection schemes.
    Anyway, nice to see something having sense enough to provide such a scheme at least. Still, other suggestions are still welcome.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Quote Originally Posted by Elysia View Post
    Why raii is hated outside the c++ world is beyond me. It has only advantages over garbage collection schemes.
    Anyway, nice to see something having sense enough to provide such a scheme at least. Still, other suggestions are still welcome.
    I guess most languages rely on reference counting (like python) or deferred garbage collection (java etc) so resource management isn't so important to people using these languages (Bubba posted a link a while back that showed you couldn't really control memory reclamation in languages like C# whether you wanted to or not so people don't really worry about it).

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Reference counting, eh? Sounds like python should be able to destroy objects when they go out of scope automatically, then. And with the addition of the with statement, it should easily work as an RAII scheme.
    Maybe there is some hope in the world, after all...
    Last edited by Elysia; 05-29-2011 at 12:49 PM. Reason: Python! Not Pearl.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    431
    This has always bothered me too. The next best thing to C++ RAII for closing things like database connections and file handles is C#'s IDisposable interface (not a scripting language, but it sounded like you cared more about web than "scripting"). Though this still requires you to do declarations inside a
    Code:
    using(){}
    block, which much better than try/finally still isn't ideal. The lack of some type of automatic deterministic destructor is one of C#'s biggest weaknesses (I think it's a great language for the most part).
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Yeah, it's for web. For desktop, I can always use C++ unless I am forced to use another language.
    But for web, I don't have any requirements, really, so I am free to choose the best language possible.
    I put the (scripting) inside parenthesises to say it's optional or I'm not sure if it should be or not.

    I don't know about C#, though. I'm not really familiar with how it's used, so I'm not sure what features the web hosting needs.
    Does it work with most free hosts, for example? If not, what's a good, relatively cheap, paid host that has support for such scripting?
    Does many servers support C# for the web? Is it general enough, just as C++ is general for desktop?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    >>Does many servers support C# for the web?

    IIS for windows (no shock there) and there is mod_mono for apache, but I have never tried it. Might be trickier to get hosting for a decent price though, while PHP/Python/Perl hosting is all over the web.

  10. #10
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Then C# doesn't sound like a good candidate.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Really dude, throw some examples at Python for a couple of weeks. If you can deal with the horrid syntax of C++ templates and especially C++1x lamda you'll have no problems giving Python source a pass. If you don't like the facilities it has to offer, you can move on to other things, but once you combine it with some of the template/reporting engine libraries available it is a very nice language for web development.

    Soma

  12. #12
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I am going to experiment with C++ CGI and failing that, Python, I think.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  13. #13
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Quote Originally Posted by Elysia View Post
    I am going to experiment with C++ CGI and failing that, Python, I think.
    C++ - Best of luck getting it hosted, and tell me when you do so I can test some buffer over-run exploits on it

  14. #14
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I am going to experiment with C++ CGI and failing that, Python, I think.
    Is this a project targeting a third-party shared host/server?

    If so, you can pretty much safely assume that actual native compiled code is right out. A crazy lot of companies will flatly refuse you the possibility of running native code. It is idiotic in the advent of modern security measures, but it is an "old hat" rule that is likely to hamper your project.

    Soma

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Heh. Well, you never know.
    If I find someone willing to admit it (I think dreamhost does), I'll be sure to pass on my findings. It would be the best of both worlds.

    Quote Originally Posted by phantomotap View Post
    Is this a project targeting a third-party shared host/server?

    If so, you can pretty much safely assume that actual native compiled code is right out. A crazy lot of companies will flatly refuse you the possibility of running native code. It is idiotic in the advent of modern security measures, but it is an "old hat" rule that is likely to hamper your project.

    Soma
    This isn't really a project, but more of me finding what language(s) and solution(s) to use for my web projects.
    So yeah, this is just really an experiment now. It might, for example, work as a solution if I get my own server, so it's not a solution I'd throw out the window, but I might need a "backup" plan for what language to use failing the availability of hosting companies allowing native code.
    Last edited by Elysia; 05-29-2011 at 02:30 PM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What other programming or scripting languages do you know?
    By thefeedinghand in forum General Discussions
    Replies: 25
    Last Post: 08-10-2010, 04:51 AM
  2. More random thoughts on constructing scripting languages.
    By suzakugaiden in forum Tech Board
    Replies: 2
    Last Post: 01-21-2006, 01:30 AM
  3. what languages are fading ? what languages remain ?
    By dot_rain in forum Tech Board
    Replies: 32
    Last Post: 03-04-2004, 09:25 AM
  4. scripting
    By volk in forum Tech Board
    Replies: 4
    Last Post: 05-10-2003, 04:26 PM
  5. Is it good to start with Java as My first programming Languages?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 12-10-2001, 07:03 PM