Replies: 7 comments 14 replies
-
I do think the switch case feature will be very very useful in a lot of cases, however it will be hard to think of a pattern which doesn't look really messy, the only thing i can think of is
where the |
Beta Was this translation helpful? Give feedback.
-
It depends what direction you want to take your new Skript language in. The original Skript was never intended to be a fully-fledged feature-perfect programming language and its core features were:
Now 2. and 3. aren't terribly relevant here - but 1. is. Switch statements may be common in programming languages, but they aren't always very intuitive (at least without explanation.) This would detract from Skript's accessible and english-readable nature to an extent. Now you've already done this with things like || and && operators, etc. so it looks like you're not really concerned about the original purpose anymore. That's absolutely fine, since what you're creating here is effectively a new language with a new purpose, so you get to choose what direction you want it to go in and what you want the core objectives to be, however it would be worth making these objectives clear now. Do you want Skript to be a niche thing - a simple and english-based language? If so, I would personally recommend dropping On the other hand, do you want this new Skript to be another scripting language? If so, add in switches and the other common language features, or it'll just end up being a feature-lite alternative. |
Beta Was this translation helpful? Give feedback.
-
In my opinion it'd be quite a useful feature that would make writing code easier (because you don't have to repeat for example switch %something%: # this could be changed to something more english-y but idk english sooo
case "cheese":
# some uesless stuf fidkfdfkdfj
default:
# the rest Adding multiple cases for 1 answer might be a bit hard for users to understand (no offense lol) but adding support might be nice. |
Beta Was this translation helpful? Give feedback.
-
i was thought of this syntax
it's a ridiculus exemple but i haven't any else. We can also imagine add |
Beta Was this translation helpful? Give feedback.
-
The reason conversations like this are even needed is due to some being overly fixated on Skript being an "English-based language". People fiercely attach themselves to that idea such that they don't even want to add features that can potentially tread on it. To me, the more important aspect of Skript is that it is beginner friendly, not that it's English-based. The latter contributes to the former without having to dictate what the language offers. Most new developers will naturally be able to ease into an English-based language more easily, but that doesn't mean we shouldn't include standard logical structures in the language. In fact, I'd consider it a disservice to those budding developers to not include all standard logical structures. I know many people who are now very trained developers who started with Skript. The more standard programming logic we can put in Skript to help teach those new devs, the better. My take: definitely add it, and give it two main syntaxes. One can be the standard
That syntax may not be perfect but you get the idea. There's no reason English-based and programming-standard syntaxes can't live in harmony. |
Beta Was this translation helpful? Give feedback.
-
For the ones still in this discussion, do you think something like this is plausible for Skript or should it be removed (and be dependent on sections): switch {something}:
case 1:
print "First"
case 2 then print "Second" I am obviously referring to the inline-effect. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, I just wanted to tell you that the syntax has been implemented as: (switch|given|match) %object% And (case|when) %*objects%
([by] default|otherwise) Thanks you to everyone who participated to this thread and I hope to see you on a new thread soon 😃 |
Beta Was this translation helpful? Give feedback.
-
Hi everyone 👋🏻
We (developers of skript-parser) would love to know your opinion about a maybe new feature we will add: the switch case.
Like you probably know, Skript is a English-based language, so we are not sure about this syntax. Can you give us your opinion about it?
To give more precisions about what we're thinking about, I'm going to simply quote the @Mwexim's questions from #92:
I would like to add this question:
I would like to hear the community's opinion about it. Thanks to anyone who tell us their opinion 😃
Beta Was this translation helpful? Give feedback.
All reactions