Having both cont and count in the same function isn't great, easy to misread it, I guess I'll rename cont to continued even though it's uglier...

Follow

@vaporeon_ in software egineering we use full words for all our variable names

@wallhackio @vaporeon_ One time Holly shared some code with a variable called c and Caleb killed her ass dead

@amy @wallhackio @vaporeon_ is this bad? this is how I name all my variables. Usually 1 or 2 letters.

I mean, mine is for writing scripts that perform video editing, so calling back to which clip I'm referring to should be as few letters as possible? since I'm typing it a lot

@The_T @wallhackio @vaporeon_ The general wisdom here is that "It's very easy to write code that computers can read, so what you should be focusing on is writing code that humans can read"

@The_T @amy @wallhackio I don't think that it's bad to have single-letter variables in general, but if there are a lot of them and the letters aren't at all related to what the variable stores, then the code becomes hard to read...

E.g. for my program's function that handles backslash-escapes, I've found it much nicer to read if the destination buffer is named dest and not d, but that's not going to stop me from using c for the current character and i as a temporary integer and so on

@vaporeon_ @The_T @wallhackio Yeah, as a general rule the smaller the scope the variable exists in the more okay it is to use a less-descriptive name

And then you have some single letter idioms, like i for loops etc

@amy @vaporeon_ @wallhackio yeah, for me it's like

I'm making a video that overlays content from my recording, monorail's recording, and Ribbon's recording (as an example)

so I name them T, M, and R.

And then when I split mine into separate parts, they'll be like TChat, TGame, etc.

@amy @vaporeon_ @wallhackio fwiw; a super common thing I'll have to do is a command(?) that is just __end__ on a line, which cuts off the script prematurely and tells it not to process anything after that; because if there's any errors in that part or it's incomplete, it will error out and not process the earlier part. So if I just need to test an earlier part, I throw that in where I want it to cut off.

Anyway, do any real programming languages actually do things like that? I've always been curious.

@The_T @vaporeon_ @wallhackio Most languages that people actually use will have some kind of exit(0) that just kills everything, or you just do an early return from the main function or something

I think the closest analogue I can think of spiritually for your use case is that you'll often split the program into functions that each perform a conceptual step that can be tested individually

@amy @vaporeon_ @wallhackio huh.

So yeah, I guess scripts are pretty different from "real" programming.

There are definitely people who can make really complex functions in AviSynth, but I've always been too dumb to figure that stuff out; like I could make one, but anything I'm doing is not complex enough to need it. If I did need something that complex, I wouldn't know how to make it in the first place.

But I've definitely grabbed functions people have needed.

(I lost a function someone wrote once that would have been super useful recently and I'm kicking myself for it. It might actually be in document on one of my old hard drives, which are now in various boxes in the living room...)

@The_T @amy @wallhackio In C, there's a function exit() which you can call to abort the program, if that's what you mean...

But more commonly, if you wanted to temporarily ignore part of the program, you'd either comment out the line (by putting // at its start) or use preprocessor directives, e.g.:

do_something();
#if 0
This part will be completely ignored by the compiler
Regardless of what you write
blorp();
#endif
do_something_else();

@vaporeon_ @amy @wallhackio yeah, it's definitely closer to "assume everything below this is commented out"

god, I write comments so little in my scripts I don't even remember what the syntax for them is

@vaporeon_ @amy @wallhackio and actually this is a lie; when I need to reference a frame number later that I'm not immediately putting in something, I will just throw it in a comment somewhere

@vaporeon_ @amy @wallhackio god I'm reading about the AviSynth grammar and I completely forgot about, subtitles and \n to put a new line in subtitles

because if I want to put text in a video, I just render it in GIMP and then create a mask, because it will absolutely look better than the AviSynth subtitles

@vaporeon_ @amy @wallhackio I'll shut up about AviSynth after this post, but, a complaint I have about it:

transparent GIFs/PNGs are so common place but AviSynth just doesn't support them. You have to make a mask to allow transparency on an image. Like, I sort of understand why; it's converting any image to a video and assuming black for any part that is transparent, but I wish it had a "assume mask" or something...

@The_T @amy @vaporeon_ @wallhackio this is somewhat akin to (but inverted from) wrapping a whole shell script in a function that is then immediately invoked so that a truncated download of it either fails to parse because the function is incomplete or fails to run rather than running a potentially unsafe prefix of the intended script

@The_T @amy @vaporeon_ @wallhackio actually a more related idea in more formal rigid haskelly languages is typed "holes" in programs where an unimplemented chunk of a program can still have a type inferred for it instead of failing to parse

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.