Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - luiscubal

Pages: [1] 2 3 ... 31
Proposals / Re: Arrays
« on: September 16, 2012, 07:26:44 AM »

Code: (EDL) [Select]
[x,y,z] = func()[1..3]

Proposals / Re: Arrays
« on: September 14, 2012, 04:48:12 PM »
Code: (EDL) [Select]
[0, x] = func();
Seems to imply that the first element should be 0. Just like this:

Code: (EDL) [Select]
Array res = func();
assert(res[0] == 0);
x = res[1];

Proposals / Re: Arrays
« on: September 14, 2012, 07:21:16 AM »
Prefix, postfix. I really don't care. It was just a proposal.

For further headaches:
Code: (EDL) [Select]
int& x = ...;
int& y = ...;
[ x > 2 ? x : y] = func();

(Basically, what if instead of just variables it actually allowed any reference? Non-references would still be forbidden)

Proposals / Re: Arrays
« on: September 13, 2012, 04:59:20 PM »
Here's my proposal.

1. If function returns a scalar, forbid [] syntax. Completely. It's worthless anyway.
2. If function returns Array, allow [] syntax but force the number of parameters to match.
3. If function returns Array but you don't want to use all parameters, use
Code: (EDL) [Select]
[a, b, c, ...] = func();Still, the array would be forced to have at least 3 elements.
4. If this is *still* not acceptable, you could have this:
Code: (EDL) [Select]
[a, b?] = func();or
Code: (EDL) [Select]
[a, b=2]=func();That code would work for func() returning both 1 or 2 parameters. It'd still be an error for 0 or more than 2 parameters (for 0, use a?. For more than 2, add the "...")
Code: (EDL) [Select]
[a?, b?, ...] = func();This is inspired by function arguments syntax.

As a final note, after an optional variable, all following variables must be optional. So this would still be an error:
Code: (EDL) [Select]
[a?, b] = func(); //ERROR!
As an extra note, __unused could be used for worthless variables:
Code: (EDL) [Select]
[__unused, x, __unused, __unused?, y?] = func();
cout << __unused << endl; //ERROR: __unused is not defined

If you dislike this syntax, this could also be used (although it might be more error-prone):
Code: (EDL) [Select]
[, x, , ?, y?] = func();

Proposals / Re: Arrays
« on: September 13, 2012, 02:43:34 PM »
Agree with
Code: (EDL) [Select]
[x, y] = array_func();
Disagree with
Code: (EDL) [Select]
[x, y] = scalar_func();

Proposals / Re: Named loops vs numbered breaks
« on: September 13, 2012, 01:48:45 PM »

Code: (EDL) [Select]
z_loop: for (int z = 0; z < 100; ++z) {
   y_loop: for (int y = 0; y < 100; ++y) {
      x_loop: for (int x = 0; x < 100; ++x) {
          break z_loop;
Code: (EDL) [Select]
instance_loop: foreach (auto instance : instances) {
     adjacent_instances_loop: foreach (auto adjacent : instance.adjacent_instances()) {
         break instance_loop;
Seems pretty clear to me.
Frankly, I'd generally avoid using integers for anything that can be reasonably named, but whatever.

Just remember: more features mean more test cases.

And regarding test cases, don't forget to add mixed loops/switch cases to your test suite.

Proposals / Re: Resource group load/save functions
« on: September 13, 2012, 12:27:50 PM »
I approve this concept. I've even thought about implementing this concept multiple times in my own game projects (although IIRC the idea never went ahead)

However, I'd change the API:
Code: (EDL) [Select]
resource_group_id_t resource_group_load(string group_name);
void resource_group_unload(resource_group_id_t id);

resource_group_load_request_t resource_group_load_thread(string group_name);

//Wait for the loading to be finished.
resource_group_id_t request_group_thread_join(resource_group_load_request_t request_id);

//Tries to join, but does not hang if the loading is not done. Useful for loading screens.
bool request_group_thread_try_join(resource_group_load_request_t request_id, resource_group_id_t& group_id);

Feel free to change the type names (I just used these so the meaning would be easier to understand).

If a OO-style API is acceptable, then this could be further changed.

Proposals / Re: Named loops vs numbered breaks
« on: September 13, 2012, 12:19:53 PM »
Yet one more reason to avoid numbered breaks: Some people might expect "start at 0" while others will expect "start at 1".

Proposals / Re: Named loops vs numbered breaks
« on: September 11, 2012, 04:05:25 PM »
I voted named loops because it's less confusing, more intuitive and less error-prone.
Besides, it's the way Java does it so there are already precedents showing it can work.

Regarding the "error prone" part, imagine if you replaced that if case with a switch case. Then you'd have to change "break 2" to "break 3". Would you remember? That would be a pretty messy bug to track down. With named loops, there is no such problem.

Regarding warnings to "break 1". Why even allow it in the first place? Just ban it with a compile error. Problem solved. One less horrible feature to test.

The question to ask about "numbered breaks" is not "can we add it easily?", which I have no doubt you can if you can also do named loops. The real question is "what would this improve?". I can not think of any situation where numbered breaks would beat named breaks.

BTW: Just call the loop "outer_loop: for(...)"

Announcements / Re: k done
« on: July 21, 2012, 10:04:59 PM »
TGMG has a massive testing platform running on it
Can't(in fact, shouldn't) you port it to other platforms too? I mean, wouldn't this testing platform also help finding platform-specific bugs that would otherwise not be found (since an OS X-only testing suite can't find Windows/Linux bugs)

Announcements / Re: wtf am I doing
« on: July 18, 2012, 08:18:16 AM »
Instead of running ENIGMA through Java, can't you just directly run the commands via command line (thus bypassing Java<->Valgrind interaction nightmares?)
Aside from that, you can always turn on all warning-related flags you can find.

If the file isn't too big, you can do things the classic gdb way. Jump into, Jump Into, Jump Out, etc.

Announcements / Re: Das Newspost
« on: July 12, 2012, 07:22:16 PM »
Ah. In what way is this related to the JustDefineIt project? Also, is this C++-only or does this include the EDL language extensions(or whatever you call them)?

Announcements / Re: Das Newspost
« on: July 12, 2012, 09:11:24 AM »
So what are the main differences between this new parser and the previous ones?

Announcements / Re: New members
« on: March 24, 2012, 10:35:58 AM »
"Name a yellow fruit: "
I hope this accepts "apple" because yellow apples do exist.

Announcements / Re: Why does it look like nothing's happening?
« on: March 07, 2012, 01:08:40 PM »
"deleting spree". Doesn't git(and SVN, for that matter) keep a history that pretty much makes this sort of thing fixable in less than 5 minutes?

Couldn't you just go pick the previous versions of the deleted files on git (or your old SVN, if Rusky somehow broke git that badly), then add the missing files back to git so people who checked out git directly would have a working copy?

Pages: [1] 2 3 ... 31