• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

HIVE

Malhorne
Malhorne
No I mean this is fine, but the kind of syntaxic sugar and simplification Python add mostly makes sense because of the language's purpose. However I'm not sure it would fit the C++ purpose.
Don't take my word for granted on it, I'm no C++ expert last time I did something serious on it was 2 years ago , even tho I did a professional training on this language ~4 months ago, I'm currently not using it.

Concerning Wurst it would be interesting, but that does not cover the main problem which is: you can't implement every amoosing feature in JASS so most of the time you'll have to rely under bad stuff (it fortunately for you does not concern generic stuff due to how it is compiled).

Ah oh .. I don't know. I mean why not every piece of documentation we can assemble is quite worthwhile. However I don't see myself interested enough to be a driver of such a project.
D
Deleted member 219079
Python boasts terse language structures thanks to its dynamically typed nature. However, though I have no industry experience, I'd watch out for an eerie conjunction of Python, large code base and technical debt. I'd guess Rust deals with this the best, given its scrupulous compile-time checks whereby little leeway for laziness is offered.

Well, you wouldn't be held at gunpoint and forced to use its dubious features, such as typecasting via fogstate bug. On the other hand there's stuff like tuples which have guaranteed allocation elision and copy semantics. So tuples are actually faster than any vJASS counterpart!

I could make the list! :) But you can be my advisor and list some idioms you know, if you don't mind ofc!
Malhorne
Malhorne
Yup and this is mostly due to the fact that it is an interpreted language and stuff can be made at runtime.
What you're saying it somewhat of a nightmare, but trust me the worst is probably a C++ 03 (or older) huge codebase x)
To be fair Rust isn't used at all in most companies.
I know Mozilla uses it ... and that's all I guess.
I don't say it is a bad language, I just say the ecosystem can't compete, and that's probably what matters the most for languages nowadays.

Especially when you can have typecasting with return bug :p
And how these tuples are implemented in JASS? Because I mean you have to translate into JASS at the end.

Why not helping on some stuff :)
D
Deleted member 219079
I can believe. You can misuse C++ in so many ways; after all, one of the core tenets of the language reads "implementing feature is more important than preventing every possible misuse of the language", or something.

It's explained here: https://wurstlang.org/manual.html#tuple-types
It's the same as specifying a bunch of variables, e.g. tuple pair(int a, int b) could just be written like two variables int a, int b.

I've updated it a bit and added two idioms: https://www.hiveworkshop.com/pastebin/012a9d919a98fd0210b80f3da56baff319140/
I'll probably create a thread for it sometime soon, but hopefully I can come up with more. Would be a delight if you shared a couple of your secrets too! :P
Malhorne
Malhorne
Ahah yeah this motto sounds so truuue for C++. It isn't user friendly sometimes.

Oh I see. I mean I don't see cases where I would like to use tuples in vJASS. Maybe I'm too close to JASS to do so I guess. But I understand what they're doing. Good approach anyway.

Let's keep it there for now, I'll help review it in its entirety if you want. I'll also add some stuff if I find some cool ideas, except that for now I want to get back my ideas/skills since I lost basically everything I had in my previous sandboxes ^^
D
Deleted member 219079
Well, you could supply tuple into a generic data container. I guess you could achieve the same with an intrusive container, though. Edit: Ah, nope, you can't use tuples in generic class type parameters, I just read the manual a bit further. TT

Yeah you could review it before I submit it, if you don't mind! :) Probably by rummaging through Nestharus' GitHub I could find some interesting idioms. Right now I can think of assert macro which I've shamelessly thieved from him in the past.
Malhorne
Malhorne
Ahaha see? The translation to JASS is real problem x)

Yeah I'd be glad to review it, it's been a long time I did not do any review for modding, it's quite nostalgic :)
Assert macros, you mean using macros to assert values?

I just realized that I lost everything from back then considering all the resources I've ever developed. That's a good point because there were a lot of shit, but also a bad point because I start from scratch basically. Anyway I'm doing my first libraries and if I use some strange tricks that I remember I might tell you ^^

I wanted to do some timer shit with bytecodes to call the callback which would result into the fastest Timer library but still thinking on how to do it properly
D
Deleted member 219079
Well, assert anything, I finished that chapter, so feel free to check the pastebin.

You have some submissions here on Hive, so you can garner some code from them I bet.

You could probably have timer system with only one timer, with callbacks sorted in an ascending order by their expiry time. You'd only store the expiry relative to the preceding timer; like such: given timers (ID: expiry) of (1: T), (2: T+12s), (3: T+5s), you'd store them like (1: T), (3: 5s), (2: 7s).
Malhorne
Malhorne
Okay I might give it a look :)

Yep between my tutorial and my submissions I managed to do a simple spell quite quickly (finding my own bugs is still hard without any way to debug it haha)

Yes but you'd have to call a callback every 0.0312500 to have some precisions and this is not necessary what you'd want.

Since that for every spell I use 0.0312500 loops I'd like to use only one timers and have a callback lists that I call from bytecodes to avoid using triggers :)
D
Deleted member 219079
Why do I need to call something periodically? Why not just on the expiry of the first entrant?
Malhorne
Malhorne
Ah okay I see what you mean. However how do you insert your entries in your tables?
D
Deleted member 219079
If you mean how to store the callbacks, filterfunc array:
native Filter takes code func returns filterfunc
Malhorne
Malhorne
No I meant -> How do you insert a timer entry in your structure? And I guess here is the reason why we don't do it.

The best way for callbacks is to store them inside a trigger, this is the solution used by Nestharus inside Timer Tools.
D
Deleted member 219079
Like this (in Zinc):
function Register(real t, code c) {
Timeout it = Timeout(0).next;
while (0 != it && t > it.t) {
t = t - it.t;
it = it.next;
}
CreateBefore(it, t, c);
}
Malhorne
Malhorne
Yes so O(n) for each insertion that's the matter actually :)
D
Deleted member 219079
You and your performance, pfft. I'm close to strutting over to the Wurst camp. Just kidding, lol...

I just heard that JassHelper might get replaced by a vJASS-to-Lua transpiler. So to stay low-level, shouldn't you switch to Lua? :p I'll take my shot at TypeScript, this old dog is going to learn some new tricks.
Malhorne
Malhorne
The problem with timer libraries is that they often have performance problem hence my comment ;)
The best timer library since a long time is Timer Tools.

Yes because ... I LOVE LUA. So I'm totally in for that haha
I know we can code in Lua now, but I'm stuck in 1.26 so no Lua for me yet.
TypeScript is like Javascript for people fed up with Javascript madness. I used to find Javascript quite interesting but these bugs it could induce were pure madness sometimes. Typescript is good thing imo.
D
Deleted member 219079
This is a good template, if you ever get a version with Lua working. Or I don't know if it's good, but that's what I'm using. :p
https://github.com/Promises/Warcraft3-Typescript-Base

Edit: Yeah, TypeScript is dope. I'm a big fan of statically typed code. Firstly because it's self-documenting code, secondly because in C++ it enables many TMP opportunities.
Malhorne
Malhorne
Wut is this XD ?
I mean it is still something that will produce JASS at the end? What's the point x) ?

I won't say it's dope but it's quite interesting, I still prefer Python imo because the syntax can sometimes quite cryptic in Typescript.
Self-documented code has its limits tbh.
What do you mean by TMP opportunities?
D
Deleted member 219079
It'll produce Lua using this: https://github.com/TypeScriptToLua/TypeScriptToLua

Sorry for lingo. I mean metaprogramming in C++ is largely achieved with template metaprogramming (TMP), and templates are all about monomorphization, instantiation against each template parameter permutation. You can make calculations on type-level alone:

template <int N> using num = std::integral_constant<int, N>;
template <int... Is>
auto sum(num<Is>...) -> num<(Is + ...)>
{ return {}; }

static_assert(decltype(sum(num<1>{}, num<2>{})){} == 3);

I purposely did not use constexpr (C++'s other mean of MP) to demonstrate TMP specifically.
This all remains on type-level; you can delegate computations to compile-time, as is done with e.g. Boost.Hana.
Top