ENIGMA Forums

General fluff => General ENIGMA => Topic started by: RetroX on October 25, 2008, 08:37:33 PM

Title: Alternate to cpp {}
Post by: RetroX on October 25, 2008, 08:37:33 PM
Wouldn't it be better to make the cpp {} statement into something like cpp <>?  For example, I could not do something like this:
cpp {
if (somecode)
 {
}

ENIGMA_function();

cpp {
}
}

While I could like this:
cpp <
if (somecode)
 {
>

ENIGMA_function();

cpp <
}
>

Just a suggestion.  This is used in PHP very often, and I think ENIGMA's C++ should act the same way.
Title: Re: Alternate to cpp {}
Post by: notachair on October 25, 2008, 10:24:09 PM
Code: [Select]
[code]Use that.[/code]
Title: Re: Alternate to cpp {}
Post by: death-droid on October 26, 2008, 02:05:22 AM
It wouldn't work RetroX because C++ is not php.
You just cant do it because to convert it it would just end up being the exact same because C++ doesn't support< > and it would just make the compiler error. :'(.
Title: Re: Alternate to cpp {}
Post by: score_under on October 26, 2008, 03:57:19 PM
It wouldn't work RetroX because C++ is not php.
You just cant do it because to convert it it would just end up being the exact same because C++ doesn't support< > and it would just make the compiler error. :'(.
What now? As far as I know, cpp { } is not valid C++ either. It'll have been preparsed before it's compiled.

BUT

cpp <
if(a>b)
{
  cout<<"Something";
}
>
Would fail.

So, I suggest something like
cpp {{
if(a)
{
  if(b)
  {
    thingy();
  }
}
}}
(where 2 braces in a row on the same line with nothing in between ends it)
Title: Re: Alternate to cpp {}
Post by: death-droid on October 26, 2008, 05:23:25 PM
Engima (As far as i know)When it converts removes the cpp{} as it is no longer required.
Title: Re: Alternate to cpp {}
Post by: Rusky on October 27, 2008, 06:03:26 PM
I suggest finding a symbol not used in C++. | maybe? (not sure if that's used or not)
Title: Re: Alternate to cpp {}
Post by: Kazuki on October 27, 2008, 08:18:43 PM
I suggest finding a symbol not used in C++. | maybe? (not sure if that's used or not)
http://www.learncpp.com/cpp-tutorial/38-bitwise-operators/
| is used in C++.
Title: Re: Alternate to cpp {}
Post by: death-droid on October 28, 2008, 12:26:52 AM
then < and > would be fine if you want something that's not C++.
As long as it isn't << or >>
Title: Re: Alternate to cpp {}
Post by: Rusky on October 28, 2008, 06:13:11 PM
Right, bitwise or. XD
< and > are used in C++, they're less than/greater than and for templates.
Just about every symbol is used by now...
maybe something more python/ruby like?
Code: [Select]
cpp
//cpp here
endcpp
or # or $ perhaps?
Title: Re: Alternate to cpp {}
Post by: RetroX on October 28, 2008, 08:02:10 PM
What about [cpp][/cpp]?
Title: Re: Alternate to cpp {}
Post by: Rusky on October 29, 2008, 06:15:43 PM
what if you use an array and have an index stored in cpp?
Title: Re: Alternate to cpp {}
Post by: sprintf() on October 29, 2008, 07:46:10 PM
You couldn't because cpp is a reserved keyword.
Title: Re: Alternate to cpp {}
Post by: serprex on November 02, 2008, 08:07:03 PM
What if cpp{} is consistent with all the other keyword syntax block structures and so all your syntax ideas are just making things more complicated?
Title: Re: Alternate to cpp {}
Post by: RetroX on November 03, 2008, 03:38:18 PM
What about cpp <{ }>?
Title: Re: Alternate to cpp {}
Post by: score_under on November 03, 2008, 03:45:17 PM
What about cpp <{ }>?
Do we have a winner? :D
Title: Re: Alternate to cpp {}
Post by: Rusky on November 03, 2008, 06:36:43 PM
What if cpp{} is consistent with all the other keyword syntax block structures and so all your syntax ideas are just making things more complicated?
okay, but the point is to allow split-up blocks which isn't consistent with "all the other keyword syntax block structures"
Title: Re: Alternate to cpp {}
Post by: Josh @ Dreamland on November 16, 2008, 08:44:39 AM
Nah, that's again, silly.

cpp {} is for people who are well-versed with C++. I assumed people would mostly leave it alone, as it's totally unnecessary at this point. It's for raw power when you need it, as is asm{}, but no one's touched that. (Go figure)

Think for a second, though. ENIGMA converts your games to C++, right? But you're asking what about running GM functions in cpp {}? They're run in C++ all the time. The only differences you'll encounter are with functions like min() and max(), as they only take two parameters in C++; along with instance_destroy() as it has to be passed the ID. (instance_destroy(id))

This doesn't go for with(), though, which is only in EDL. switch() and things are also different.
This is why I don't see the point in using cpp {} at all, especially not like you just did. EDL is more versatile with if() statements and the sort, anyway. Why would you  want to use cpp{} in there? So when you say
Code: [Select]
if a=b {} You get a compile error?
So when you say
Code: [Select]
if (a=b) {} It sets a to b, then checks if b > 0?
Those don't sound like very fun problems to encounter.

Title: Re: Alternate to cpp {}
Post by: score_under on November 19, 2008, 06:10:06 PM
asm{}, but no one's touched that.

...

I don't see the point in using cpp {} at all

...

Code: [Select]
if (a=b) {} It sets a to b, then checks if b > 0?
Those don't sound like very fun problems to encounter.
I've used asm(), but not EDL's asm{} before. I would use C++ in those cases where I can't wait for the next enigma update, and if I ever wrote an "if" like that and DIDN'T mean what C++ would interpret it as, I would spear myself with the nearest knife. Seriously, it's a bad coding habit.
Title: Re: Alternate to cpp {}
Post by: Josh @ Dreamland on November 30, 2008, 10:22:13 PM
then what's wrong with cpp { if() {} }?

For EDL'ers that aren't good with C++'s more picky syntax, they'll never need cpp{} around  only a starting brace, unless they're just taking code from somewhere else, in which case they should still be versed enough as to use semicolons.

The only time it'd be nice to have cpp <> is for a complex C++ for loop, followed by a with statement. But I don't think we'll be seeing much of that.

Maybe if someone actually turns up a case where cpp <{}> would be useful... otherwise it's just more symbols to type.
I suppose I could make it <{}> or {}, but...

I'll think about it.
Title: Re: Alternate to cpp {}
Post by: qc.zackf on August 03, 2009, 12:01:46 AM
I think it's perfect how it is.  It really doesn't need to be any more simplified:

Code: [Select]
cpp
{
    for(i = 0; i < 9; i++)
    {
        cout<<"The for-loop looped "+i+" x's!\n";
    }
}

Just a "simple" example.
Title: Re: Alternate to cpp {}
Post by: Rusky on August 03, 2009, 12:48:26 PM
cout << "bla" << i << "bla";
+ doesn't work with c++ string literals.
Title: Re: Alternate to cpp {}
Post by: Josh @ Dreamland on August 05, 2009, 11:03:26 AM
As of R4, C++ is totally usable anyway. Meaning ++ and cout will both be available to you.

I may leave cpp {} in for people who understand parsed-EDL syntax, and are faced with a compile error that is not yet fixed.
Title: Re: Alternate to cpp {}
Post by: qc.zackf on August 05, 2009, 11:13:12 AM
cout << "bla" << i << "bla";
+ doesn't work with c++ string literals.

I've been using C# for way too long...  :-\
Title: Re: Alternate to cpp {}
Post by: RetroX on August 05, 2009, 03:04:25 PM
I've been using C# for way too long...  :-\
Wash your hands, mouth, and brain with soap.
Title: Re: Alternate to cpp {}
Post by: Rusky on August 05, 2009, 04:53:40 PM
C#'s not evil, silly.
Title: Re: Alternate to cpp {}
Post by: Josh @ Dreamland on August 07, 2009, 07:21:11 AM
Since when?
Title: Re: Alternate to cpp {}
Post by: Rusky on August 07, 2009, 10:29:33 AM
Since it's garbage collected, on a unified framework, has a lot of cool features, isn't becoming a giant language full of crap nobody wants like C++0x, types are nicer (e.g. no 0 == false crap), and it still lets you drop into "unmanaged" code.
Title: Re: Alternate to cpp {}
Post by: RetroX on August 07, 2009, 10:35:50 AM
It's not cross-platform, and Microsoft's way of ripping off C++, so it's instantly uncool.
Title: Re: Alternate to cpp {}
Post by: Rusky on August 07, 2009, 12:12:32 PM
The language is cross-platform. .NET may not be, but the language itself is.
And it's not "ripping off C++". C++ is a giant, mangled, brain-dead version of C. It's intended for a different area. C# is more "ripping off" Java, if it's ripping off anything. And ripping off Java is fine.
Title: Re: Alternate to cpp {}
Post by: luiscubal on August 09, 2009, 01:01:59 PM
One word: Mono
Title: Re: Alternate to cpp {}
Post by: score_under on August 13, 2009, 04:29:32 AM
The language is cross-platform. .NET may not be, but the language itself is.
And it's not "ripping off C++". C++ is a giant, mangled, brain-dead version of C. It's intended for a different area. C# is more "ripping off" Java, if it's ripping off anything. And ripping off Java is fine.
The only reason people like C# is because Microsoft is good at marketing.
Title: Re: Alternate to cpp {}
Post by: Rusky on August 13, 2009, 12:36:52 PM
That's retardiculous. The reason people like C# is that they've used it and it's good.
Title: Re: Alternate to cpp {}
Post by: qc.zackf on August 13, 2009, 12:44:09 PM
Yep.  C# is nice, just not developer friendly when it comes to cross-platform development. Damn Microsoft! Greedy bastards!
Title: Re: Alternate to cpp {}
Post by: RetroX on August 13, 2009, 02:01:43 PM
Microsoft seems to have lost their roots, a lot.  Windows 98 was incredible for the time.  2000 wasn't as stable, but a much better OS.  There are even some interface things XP should have had (audio preview in explorer, etc).  Vista was feature-bloated and unstable.  Windows 7 is great, but still quite bloated.
Title: Re: Alternate to cpp {}
Post by: serprex on August 15, 2009, 01:47:48 PM
I'd like to openly commend Rusky for not joining in on you boys' little antiMS jackoffathon
If C# is just a rip of Java, it is at least an attempt to be a modernized rip
& let's keep it straight on the C#/.NET dichotomy
Title: Re: Alternate to cpp {}
Post by: score_under on August 16, 2009, 02:20:06 PM
If C# is just a rip of Java, it is at least an attempt to be a modernized rip
I realize. It's still a rip, and the attempt was failed.
Title: Re: Alternate to cpp {}
Post by: RetroX on August 16, 2009, 08:06:26 PM
I realize. It's still a rip, and the attempt was failed.
*high five*
Title: Re: Alternate to cpp {}
Post by: Rusky on August 17, 2009, 09:50:10 AM
I realize. It's still a rip, and the attempt was failed.
*high five*
You're both pathetic. C# as a language is far better than Java. You're just blind because MICRO$0FT IS TEH SUX0RZ DURRRRRR
Title: Re: Alternate to cpp {}
Post by: score_under on August 17, 2009, 10:45:00 AM
You're both pathetic. C# as a language is far better than Java. You're just blind because MICRO$0FT IS TEH SUX0RZ DURRRRRR
No, you're blind to our thoughts because you think we're blind because you think we think Microsoft sucks. ;)
Title: Re: Alternate to cpp {}
Post by: Rusky on August 17, 2009, 12:23:41 PM
Duh! You haven't even given any thoughts! If you want to give some I might be able to see them. I've actually used C#. Have you? I've actually used Java as well. How about you? Both? Somehow I doubt it after this conversation.
Title: Re: Alternate to cpp {}
Post by: antidote on August 17, 2009, 01:29:12 PM
I've used C# and I can vouch for both its flexibility and ease of use. However narrow minded thoughts like yours are just giving C# and .NET a bad name .NET has been the brainchild of many developers spreading across several companies (Intel and Sun being two) Microsoft's take on .NET is it's own and Sun is actually working on creating it's own version.

Also C# was not and is not and M$ only thing both Sun and Intel have had a say in it's creation although M$ did most of it's development.