Return to “Scripting & Modding”

Post

Re: LTSL - The LT script language

#63

Code: Select all

  # is this
  still a comment?
Ie. if I precede everything with two spaces, is the second line a comment or a function?
(Devil's advocate)

Also, I know Josh uses a cool custom IDE for coding, might this be available with LTSL to allow us to understand comments and their associated functions better?
(We had a good variance of text editors recently, and I thought it might be better if LT has it's own LTSL editor to help the masses of new and existing scripters).
YAY PYTHON \o/

In Josh We Trust
-=326.3827=-
Post

Re: LTSL - The LT script language

#66

Code: Select all

  # is this
  still a comment?
I suspect the answer is no. That second line would be a "live" statement.

But all of this would be a comment:

Code: Select all

# is this
    still a comment?
The key seems to be "subexpressions." Sticking the comment character # at the start of an expression would seem to make the initial line commented out, as well as all subsequent lines that are nested by indentation to the initial line of the expression.

In other words, when you stick a # character at the start of any line, everything after that is commented out until the indentation level returns to the initial indentation or left of it.

FWIW, I will be defining an LTSL coding style rule for myself: any and all lines meant to be commented out must have a "#" in front of them. Otherwise it is certain that there will be more than one occasion on which I will be looking at a big pile of code, I'll edit it, I'll run it, I'll be very confused why the change didn't seem to do anything, I'll go back to the code and stare at it for X amount of time until I finally realize that I'd edited a line that had inherited the "commented out" property from a line way up in the code that had a "#" in front of it.

This will happen. Not all of us programmers are blessed with Josh's coding skills. ;)
Post

Re: LTSL - The LT script language

#67
ironically, this could cause performance problems :lol:

If comments work the way i think they work they are just a special function call.

A call to NOP which gets the comment text as parameter and does simply nothing with it.

So when you start to comment out 50% of your lines you have 50% redundant function calls.

Lightweight function calls, true, but still a ton of unneeded function calls.

If you have a big script with many comments it could be that you get a performance increase when removing the comments or optimising the comment calls...
Post

Re: LTSL - The LT script language

#68
Cornflakes_91 wrote:ironically, this could cause performance problems :lol:

If comments work the way i think they work they are just a special function call.

A call to NOP which gets the comment text as parameter and does simply nothing with it.

So when you start to comment out 50% of your lines you have 50% redundant function calls.

Lightweight function calls, true, but still a ton of unneeded function calls.

If you have a big script with many comments it could be that you get a performance increase when removing the comments or optimising the comment calls...
No way! That won't get compiled into the runtime code - just like a comment in c++, it will be ignored completely by the compiler :) :geek:
“Whether you think you can, or you think you can't--you're right.” ~ Henry Ford
Post

Re: LTSL - The LT script language

#69
I just assumed the most simple and unified solution for comments :lol:

Did not really expect such behavior in the first place





Regardless i'll maybe use the # comment markers as a crossover from // and /* */ markers

Code: Select all


# inline when i have single-line comments

#
    as delimiting blocks
    With multi line
    Comments
#

Maybe the in-engine text editor could color comments differently

(Im assuming that there will be an in-game editot)
Post

Re: LTSL - The LT script language

#70
Cornflakes_91 wrote:Maybe the in-engine text editor could color comments differently

(Im assuming that there will be an in-game editot)
That thought occurred to me as well. I'm able to tell my preferred editor, ZEUS, for example, how to colorize comments delimited by // and /* */ for languages that impose scoping through explicit characters.

But I can guarantee that ZEUS -- again, the text editor with which I'm most comfortable and productive -- is not going to have any idea that indentation affects scoping of everything in LTSL, including comments.

So my choices would be either:

1. Use the internal editor just to get color-coding that understands the special meaning of indentation in LTSL, and lose the editing features I'm accustomed to having in my preferred text editor.

2. Use my preferred text editor and have to worry that I'm editing something that's commented out above (or use my gimmick of sticking a # in front of every commented line even if not required by the compiler).

Neither of these options seems optimal to me. But the "# in front of every commented line" gimmick seems least painful as a practical solution.
Post

Re: LTSL - The LT script language

#71
Flatfingers wrote:

Code: Select all

  # is this
  still a comment?
I suspect the answer is no. That second line would be a "live" statement.

But all of this would be a comment:

Code: Select all

# is this
    still a comment?
This only shows that using invisible characters for scoping is a poor design choice :o .
(Yes, I go washing my mouth at once :oops: )

By the way:

Code: Select all

# comment
  Comment with two spaces
   Comment with three spaces -> comment?
  Back with two spaces -> comment?
 Only one space -> comment?
I agree that the only way to make it somewhat less risky is to have a policy that every line begins with a sharp. And hope never to copy-paste code of a friend or forum member with another policy.

Honestly, still hoping to have an alternative there after release (relatively easy to implement in an existing parser). Let's be silent for now as Mr. Josh has more important priorities :silent: .
Image
Post

Re: LTSL - The LT script language

#72
To be fair, there is another possibility: that there will be a LTSL editor built into LT, but usable for editing other code as well, and I will like it so much more than my current text editor that I will want to start up Limit Theory The Game just to use its code editor for all my future programming projects.

I can't say that's a likely scenario. ;) But it's a possibility. I mean, I like ZEUS because it comes very close to meeting all my text editing needs, but that doesn't mean there might not be something else I'd like even better.

(Yes, that applies to programming languages, too.)
Post

Re: LTSL - The LT script language

#73
Cornflakes_91 wrote:Maybe the in-engine text editor could color comments differently
YESS, this is what I was referring to..

.. this took me an age to find, but here's what I'm referring to: Image Together with some other examples: Image and Image Considering that Josh is using a new file editor (forgotten its name), and showed us multiple windows from within LT itself, wouldn't it be so cool to be editing scripts from within LTSL within LT?
:shock:
YAY PYTHON \o/

In Josh We Trust
-=326.3827=-
Post

Re: LTSL - The LT script language

#74
Why handle Comments the same way as code? This will make writing comments a chore (as you have to make sure that you have enough intends) in my opinion.
Also i do share the concerns on Whitespaces as Scopecharacters.

And i really fear that Mathematical Expressions will be extremly hard to read for most People with the FUNC(PARAM PARAM) style. As the "Natural" way we learn to read things like add 2 to 2 is:
2 + 2
and not
+ 2 2
Also i can see the "advantages" in cases like:
+ 2 2 2 2 2 2 2
Which is like writing:
Add(2 2 2 2 2 2 2)
Its just that i have the feeling both ways should be valid.

As someone mantioned before most people who will write Stuff are not Hardcore Programmers and keeping things as close to "everyday" usage as possible will surely help getting things to work.
Post

Re: LTSL - The LT script language

#75
FormalMoss wrote:
Cornflakes_91 wrote:Maybe the in-engine text editor could color comments differently
YESS, this is what I was referring to..

.. this took me an age to find, but here's what I'm referring to: Image Together with some other examples: Image and Image Considering that Josh is using a new file editor (forgotten its name), and showed us multiple windows from within LT itself, wouldn't it be so cool to be editing scripts from within LTSL within LT?
:shock:
That isn't an in-engine editor (at least it doesn't appear to be) - that's Vim. Unless you're saying he's switched from Vim to something else...

Online Now

Users browsing this forum: No registered users and 5 guests

cron