Return to “Scripting & Modding”

Post

LTSL - Why Whitespaces?

#1
Just a short question:
Why white spaces as delimiter / formating in LTSL?
I know it does force to write "nice" code but perosnaly having worked with both Python and C/C++ i prefer the ; and { } Style by far. Especially when you have to programm on different Devices and with different Editors the Whitespaces only make it incredible hard to read Code for me.
When you are lazy and dont use Whitespaces in C/C++ i know it produces ugly and really unreadabkle code, but assuming you do use them the additional ; and { } make it much easier to read then just the Whitespaces.
Furthermore i like to have my own "Style" of Formating code (so some Blocks, some additional Tabs within a block etc. and using Whitespaces as actuall Code permits me from doing so. While a single letter is hardly an intrusion to my "personal" Style.

I know this is just my personal Taste, but I am really interested in other opinions about this and if possible and time permits especially Joshes opinion.
Other thoughts on the pros and cons of LTSL code Style are welcome too :)
Post

Re: LTSL - Why Whitespaces?

#6
Katorone wrote:Unless I'm mistaking, you're free to use either whitespace or parenthesis. You can even mix and match. :)
Hmmm.

I expect someone can correct me if I'm wrong about this, but my impression was that parentheses would only help with internal grouping of parameters to functions -- not with scoping of sub-functions within a function.

Or can it? Are sub-functions considered to be and treated as "parameters" to the function that encloses them?

Are these both valid and equivalent:

Code: Select all

function X (x y z)
    Subf1 (x)
    Subf2 (y)
    Subf3 (z)

Code: Select all

function X (x y z) ((Subf1 (x)) (Subf2 (y)) (Subf3 (z)))
[Note to mods: Would this thread be worth migrating to the S&M :roll: sub-forum?]
Post

Re: LTSL - Why Whitespaces?

#7
I think both do work - also dont you have to call the function function ( -.- ) for subfunctions as well?
as in

Code: Select all

function NEWFUNCNAME (PARAM1 PARAM2 PARAM3)
     function NEWSUBFUNCNAME (PARAM1)
     ...
And shouldnt be:

Code: Select all

function NAMEPARAM PARAM1 PARAM2 PARAM3

or

function (NAMEPARAM PARAM! PARAM2 PARAM3)
Possible as well as long as you do not call an actual function but only variables within the function function?


This syntax philosophy is giving me slight headaches currently :( Hopefully this will get better when we actually can write and test doe ourselfs (i am kind of a "try it and learn" type regarding Programming language Syntax ^^)


P.S.:
I can not tab in this editor -.- So for sharing code on the forum this is really bad :(

Online Now

Users browsing this forum: No registered users and 1 guest

cron