Confusing escape sequences and bitwise xor

PixelPaladin

New member
CX Code Contributor
3rd Party Module Dev
Joined
Aug 27, 2017
Messages
110
While writing a short Cerberus X tutorial two things confused me a bit:

1. The escape sequence '~z' is mentioned in the documentation but does not exist. So is this a bug or has it been removed but remained in the docs?

2. '~' is used for bitwise xor and for bitwise complement. Since most of the operators are same as in languages like C or C++ (where bitwise xor is '^') I wonder if this could be a mistake. I mean "A~~B" (which means "A (bitwise) Xor (bitwise) Not B") does not result in a conflict but it looks strange somehow. "A^~B" looks much clearer to me.
 

dawlane

Well-known member
CX Code Contributor
Tutorial Author
Joined
Jun 21, 2017
Messages
1,034
Your best bet for the discovering what the escape sequence ~z was for, is to search one of the old Monkey git archive to see if it was implemented to start with, or one of Marks little oversights. There are one or two errors still in the documentation, and the
Shr Bitwise shift left (signed) is still there in the Language Reference. I thought @MikeHart was meant to be updating the documentation.
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,497
I thought @MikeHart was meant to be updating the documentation.
Sorry dawlane that I am so slow. To many other things came in between. Maybe someone else should take over as I am apparently not quick enough. And for sure I don't have the biggest knowledge about the tool.
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,497
Seriously, would you like to take my place? You can have it. I am 100% positive that @Martin would like to have you onboard.
 

dawlane

Well-known member
CX Code Contributor
Tutorial Author
Joined
Jun 21, 2017
Messages
1,034
To many other things came in between.
I know that problem.

Seriously, would you like to take my place? You can have it.
I think you are doing a fine job mate with the web site etc, but from one of your other posts a while back on the subject I thought that was what your intentions were to fix the documentation. Sorry if I caused offence.
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,497
Sorry if I caused offence.
Yes it kinda did. And for serveral reasons (posts by others, lack of response, your response), I think my work doesn't mean much here. So I gladly step aside. I was happy to help CX get off the ground. I put everything aside of my personal projects and made this my top priority.
I fixed bugs, I added functionality to mojo and mojo2. I setup the site, dealed with the short commings of the forum themes. Learned how to create a Wordpress theme from scratch. I run the twitter and facebook accounts and take care of them. I take care of the community when Martin has no time. But I guess it isn't enough. Sorry that I can't do more. I have a fulltime job, a family with kids, a dog and and and. And THAT should be my main priority.
Martin had and still has my 1000% support as I call him my friend. That won't change. :)
 

dawlane

Well-known member
CX Code Contributor
Tutorial Author
Joined
Jun 21, 2017
Messages
1,034
your response
Sometime I tend to be a bit thoughtless with my wording when posting. So I sincerly apologise.

So I gladly step aside.
Please reconsider. It wouldn't be the same without you, your input and talents.

posts by others, lack of response,
The lack of response from others I guess would be a problem when you need to know something to solve an issue. As for posts that get under your skin, just ignore them unless they are direct person attacks. I learned that over on the Blitz basic forums.

I have a fulltime job, a family with kids, a dog and and and. And THAT should be my main priority.
Yes that as it should be. My current full-time job is caring for my seriously ill farther, and sometime I wish I was back working full-time in construction; it was a lot less stressful dealing with the problems there than having to deal with his health issues.

You and Martin both have my support in your endeavours :).

EDIT: It may be worth while starting as section for Documentation bug and omissions to aid it the rising of the documentations.
 
Last edited:

Gerry Quinn

Active member
Tutorial Author
Joined
Jun 24, 2017
Messages
169
~z is supposed to be String.FromChar( 0 )

(If you're used to C-style strings, you can use the null character in Monkey strings, because they have their length stored separately.)

It's in the original Monkey documentation under Types.
 

PixelPaladin

New member
CX Code Contributor
3rd Party Module Dev
Joined
Aug 27, 2017
Messages
110
@MikeHart: Please don't give up! Cerberus has become what Monkey 1 always should have been. To the first time the community has a real possibility to get involved into the development. And with a growing community this project has a lot of potential. Like dawlane wrote, a section in the forums for documentation issues or some other possibility for the community to help improve the docs could be a good thing.

@Gerry Quinn: That is right, I also use String.FromChar() but wondered why this escape sequence does not work. It seems like null characters are not supported on some build targets which could be the reason why it has not been implemented.

As for the bitwise xor: to me it looks like a mistake since so many languages use the '^' character (c, c++, java, python, perl, …) plus the fact that it is used as operator for bitwise complement at the same time. In my opinion Cerberus should also use '^' too and maybe keep the '~' in for compatibility with old code. It could be added easily to the compiler. I just tried it out myself and added '^' and '^=' to the compiler and it works. If anyone is interested in the code, here it is (also contains the enum stuff I added experimentally):
 

Attachments

  • custom_trans.zip
    51 KB · Views: 229
Top Bottom