|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need stronger typed language then Python
I am currently developing an html editor- its going to be the worlds best of course. I am liking Python but it is a little to weak-typed for my likings. I want typed checking and interfaces so I can kill those nasty runtime errors. I would like to port some of the code to a stronger typed language like such as C or Java or something but keep TK (Tkinter) as the user interface. Converting the code does not need to be done all at once but I would like to possibly interface the 2 languages together.
Any ideas dudes ![]() |
|
#2
|
||||
|
||||
|
C isn't an OO language, so if you want OOP constructs/concepts like interfaces then you'll be looking at Java. In which case you might want to check out Jython:
http://www.jython.org/ Or maybe you could use C++ but I've only heard of extending CPython with C, though it should be possible to use C++? You should read though the Extending and Embedding section in the Python docs: http://www.python.org/doc/2.3.4/ext/ext.html I hope this helps. Good luck with the project ,Mark. Last edited by netytan : October 19th, 2004 at 08:38 AM. Reason: Spelling |
|
#3
|
||||
|
||||
|
Tkinter is a wrapper for Tk/TCL which is another language altogether.
Some Tkinter objects are combinations of Tk widgets written in Python so unless you are very lucky you will still need to include Python in your program. (or re-write them in your chosen langauge )If you want to look at TCL/C integration http://www.humbug.org.au/talks/tcl/tclintegrate.html Here's something worth reading: Strong versus Weak grim ![]()
__________________
*** Experimental Python Markup CGI V2 *** |
|
#4
|
|||
|
|||
|
Quote:
C not Object Oriented? I bet I can find a crazy nut out there to disagree with you. I am sure there are elegent workarounds. I just don't like C++ it just adds complication and ugly dependencies. There so many foo-langeuge-to-c converters out there and c is so standerd also. J |
|
#5
|
|||
|
|||
|
It is a common misconception that Python is weakly typed - it is strongly typed, but the type checking happens are runtime rather than at compile time as in C++. The correct distinction is between static typing (at compile time) and dynamic typing (at run time).
The advantages of static typing for writing correct programs are debatable at best, and illusory at worst. There has been a definite move away from them over the last few years. With the rise of Test Driven Development dynamically typed languages can be used as safely as statically typed ones. Here is an article by Bruce Eckel (author of "Thinking in C++" and "Thinking in Java") on the subject, and another by Robert Martin, former editor-in-chief of "The C++ Report". The real advantage to static typing is that the compiler can produce more efficient code, since it does not have to do work at runtime to look up methods and attributes. Take a look at Pyrex - it is the python language with additional type information, that allows the code to be translated into C and compiled. It can result in code that is orders of magnitude faster than pure python. Since it creates Python modules in C, Pyrex can also be used to interface with existing C libraries. Dave - The Developers' Coach Last edited by DevCoach : October 19th, 2004 at 03:16 PM. |
|
#6
|
||||
|
||||
|
Quote:
Nope, C is not object oriented language. Why is why C was extended to become C++ (static) and Objective-C (more dynamic). I'm sure you could find somone to argue this but as you said, they'd probably be a crazy nut . |
|
#7
|
||||
|
||||
|
Quote:
Agreed C is not object oriented, C++ is
__________________
IE QUOTE | PHP Manual | Google | C/C++ Compiler | Linux Tutorials | General Stuff Game Dev |
|
#8
|
||||
|
||||
|
find me a native way to handle inheritance et cetera in C and I'll tell you it's object oriented. until then, it's definitely not.
|
|
#9
|
||||
|
||||
|
Think you just found your crazy nut
. You don't need an object oriented language to implement an object oriented design. If you're going to use C++ features as the standard for object orientation, heck even python doesn't have quite a few features that C++ does (not that they can't be simulated though), and Smalltalk or ruby fans claim that C++ isn't object oriented enough. IIRC the python book even mentions that no one seems to agree what "object oriented" really means. With that in mind, it is perfectly feasible to implement an object oriented model in a non-object oriented language like C. It can be done, just going to be a bit more verbose.Examples: http://www.tux.org/lkml/index.html#s15-3 - Note that it says the VFS file system and Xt are written using object oriented techniques (objects with public and private data, inheritance, methods etc.). http://www.accu.org/acornsig/public/articles/oop_c.html http://ldeniau.home.cern.ch/ldeniau/html/oopc/oopc.html <--- deltacoder, this one is for you . Also note that Stroustrup's original C++ compiler was called cfront and actually translated C++ code to C code before compiling it with a C compiler!
__________________
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 Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
|
#10
|
||||
|
||||
|
I don't think the question was "can you do object-oriented stuff in C", it was "is the language itself designed to be object-oriented". Notice the "natively" in my post. But you raise a valid point.
|
|
#11
|
|||
|
|||
|
Quote:
It looks like my Spidy senses were correct after all, I did find a article about object orientation in ANSI-C (not C++ or Object C) by Axel-Tobias Schreiner in PDF A quote “If it is impossible, what are you waiting for ,go do it” ![]() |
|
#12
|
|||
|
|||
|
Quote:
The problem with C++ is that it is so complicated that it negates the any object oriented abilities it implements, I am smelling and hoping that C is a better alternative to C++ with the speed I need too. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Need stronger typed language then Python |
| Thread Tools | Search this Thread |
![]() |