Computer Science Canada If you could change Turing |
Author: | mirhagk [ Tue May 29, 2012 2:15 pm ] | ||||
Post subject: | If you could change Turing | ||||
A simple question. What do you hate most about Turing, or what feature do you find lacking. If you had the opportunity to change it, what would you change. Keep in mind that ideally you'd want to not break all of existing code, or at least break only obscure code/areas that need to be fixed. One area for me would be the classes, the features of classes are decent enough, but the syntax is much to ugly, and scary to new users. I would change it to mirror the sytnax for types (ie object.property instead of object -> property). Another area would be forcing the user to have to explicitly declare pass-by-reference parameters in calling functions. So:
would change into
This would of course break existing code, but the compiler could simply throw a warning and compile anyways for the first release. What would you change, add or remove? |
Author: | crossley7 [ Tue May 29, 2012 3:06 pm ] |
Post subject: | RE:If you could change Turing |
I would not endorse that change as no other language I have used with much regularity or seen significant code of has required a declaration of that. It is neither intuitive nor is it an advantage to the coder. I want as few useless words in my code as possible and in my opinion the word var falls into that category. The suggestion for classes however does make sense also keep in mind that what you wrote up there is not an actual turing function but a procedure which works differently. Functions have their own (albeit similar) syntax using the word function (or func?) instead of procedure/proc. something to change would be in no particular order: foreach function (similar to python's for x in list type of thing) no more end if/for/loop (just either use {} or indentation to determine the end) array subscripts in the form [i][j] instead of (i,j) once again to make it an easier transition to other languages and make subscripts clear from function parameters in terms of syntax. Now generally these are small suggestions and basically just highlight my distaste for turing style syntax and a few suggestions on what it could look like. Also I don't really care as I rarely code in Turing any more and I know that development of the language is done by people on this site as they find time to do it rather than as a full time occupation |
Author: | Tony [ Tue May 29, 2012 3:40 pm ] | ||||
Post subject: | Re: If you could change Turing | ||||
mirhagk @ Tue May 29, 2012 2:15 pm wrote: I would change it to mirror the sytnax for types (ie object.property instead of object -> property).
The issue is not of syntax but of operator precedence, where dot-operator was weighted higher than a dereference of a pointer. Possibly because C++ does the same (wrong) thing. You can still use .property, as long as you deference first
vs
|
Author: | mirhagk [ Tue May 29, 2012 3:55 pm ] |
Post subject: | RE:If you could change Turing |
@crossley when I said function I meant functions and procedures. The two only really differ in their return type (something vs nothing) so I sometimes just refer to them both as the same thing. Also I am wary about the pass-by-reference change because it does potentially break code, but on the other hand it forces the caller to realize that they are passing by reference, and that what they are passing may be altered (and hopefully also make people more aware of the fact that functions/procedures with side effects are a bad idea in general (except perhaps performance, which doesn't matter in Turing, since it's terribly slow anyways)). I agree with the foreach and the array indices, although again the array indices will break existing code, so both should be supported for an intermediate version. I do prefer braces to denote beginning and end of functions instead of end, but I don't think whitespace should affect code, especially with new learners (teachers would end up removing the tab keys from the keyboards just to avoid the impending tab vs space war) @Tony yeah I figured there was some reason for it. I think Turing's syntax has always been the road of make something simple to the user, hiding the technical details of what's going on, so the whole notion of pointers should be reworked in my opinion. |
Author: | evildaddy911 [ Tue May 29, 2012 8:35 pm ] |
Post subject: | RE:If you could change Turing |
i really hate the colors, they're in an order that (at best) only makes sense to HoltSoft and fixing them takes WAAY to much time |
Author: | DemonWasp [ Tue May 29, 2012 9:40 pm ] |
Post subject: | RE:If you could change Turing |
I believe that the colour palette is actually determined by the operating system, though I could be wrong. |
Author: | Zren [ Tue May 29, 2012 9:59 pm ] | ||
Post subject: | RE:If you could change Turing | ||
I'd remove the bounding requirements of an array in order to pass it into a function. Similar to returning one. Eg:
|
Author: | Amarylis [ Wed May 30, 2012 4:52 pm ] | ||
Post subject: | Re: RE:If you could change Turing | ||
Zren @ Tue May 29, 2012 9:59 pm wrote: I'd remove the bounding requirements of an array in order to pass it into a function. Similar to returning one.
Eg:
You can remove the upper bound requirement of an array to pass it into a function, though I don't think that's of that much help to you, I imagine? crossley7 wrote: foreach function (similar to python's for x in list type of thing) A foreach function can be coded in turing itself, if one would spend the time and effort into writing java-like classes for Turing (I know that there is one in here on a 2009 post, and I've made a few of them myself), but it would not be nearly as effective, and you'd have to do so by having the foreach call up an external procedure/function |
Author: | mirhagk [ Wed May 30, 2012 6:29 pm ] |
Post subject: | RE:If you could change Turing |
The colour palette is one thing that I think should go for sure. There aren't really any good reasons to use 256 colours anymore, so upgrading to rgb colours (while still having the colour names map to the same colour values) would be nice (yes it can be done already, but in a very roundabout way). The array bound requirements is a good one actually, (for both returning and passing into). The only thing is that the current structure of Turing must known the bounds of an array at compile time (at least the lower bound) in order to convert them into arrays that are consistent with other languages. I don't know the best way to approach that (whether to create arrays that are non-consistent, and hence make calling other dll's more difficult, or to make it consistent and drop either support for lower bounds, or forcing lower bounds to be known at compile time) |
Author: | Amarylis [ Wed May 30, 2012 7:24 pm ] |
Post subject: | Re: RE:If you could change Turing |
mirhagk @ Wed May 30, 2012 6:29 pm wrote: The array bound requirements is a good one actually, (for both returning and passing into). The only thing is that the current structure of Turing must known the bounds of an array at compile time (at least the lower bound) in order to convert them into arrays that are consistent with other languages. I don't know the best way to approach that (whether to create arrays that are non-consistent, and hence make calling other dll's more difficult, or to make it consistent and drop either support for lower bounds, or forcing lower bounds to be known at compile time)
I think the big part of the lower array bounds requirement for Turing is that it can have ANY array bounds, as opposed to having a default lower bounds (i.e. 0). |
Author: | DemonWasp [ Wed May 30, 2012 9:41 pm ] |
Post subject: | RE:If you could change Turing |
Every time I think about what I would "fix" in Turing, I realize I'm rewriting Python, a language I don't even know properly.
Greedy, I know. It looks like I want a cross between Java and Python. Maybe I should try learning Scala. Array bounds: An array in a C-style language can be created with an arbitrary lower bound by allocating memory, then adding lower_bound * sizeof(entry) to it. Then, if byte my_array is allocated from 0x08 to 0xF, but has my_array = 0x0A, you can access my_array[-2] and it will be the first element. Array my_array effectively has bounds [-2, 6). Allowing bounds to be an arbitrary range [lower, upper] rather than fixed range [0, size) or [1, size], is purely syntactic sugar. I find that [0, size) makes sense nearly every time. |
Author: | Amarylis [ Thu May 31, 2012 6:44 am ] |
Post subject: | RE:If you could change Turing |
For me, allowing overloading of procedures and functions would make my life infinitely easier, also eliminating the array bound requirements of function return types |
Author: | mirhagk [ Thu May 31, 2012 8:01 am ] | ||||
Post subject: | RE:If you could change Turing | ||||
@Demonwasp a good list of changes, a few points on some of them though, 10: Really allowing Tuples would solve this issue, or anonymous types. Having something like:
Would be sufficient for those purposes, but once you add Tuples you could go one step further and provide some syntatic sugar for the following:
Which would be quite awesome. I agree with some of those points (like return,result,quit thing, and the end fcn instead of end fcn_name). However some of them could be very useful. For instance allowing var a:int instead of int a allows you to not have to specify the type name, which while just convient for certain things (basically not having to write out long names), could be extremely powerful with anonymous classes and types (and could be quite amazing if you included a smart IDE with auto-completion, being able to experiment with the output of an unknown function without having to look it up). One of the most important things for me would be the ability to call functions in compiled dll's (or the linux/mac equivalent) which would then make it possible to link in anything you wanted from another language (database access, OpenGL, OpenCL, OpenAL, better networking, threading, or whatever you need). One way a lot of these could be implemented in one fell swoop (specifically better OOP, garbace collection, dll access, working debugger) is by compiling not to machine code, but to CIL, or Java bytecode (both of which would also make it cross-platform, well if you make the CIL mono compliant) |