If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
If you're ever writing a parser in Ruby...
3 posts
• Page 1 of 1
If you're ever writing a parser in Ruby...
...don't call your parsing method "parse"!
It breaks the RubyEdit in a rather, erm... interesting way. After a bit of digging, I discovered that RubyEdits already have a method called "parse". It gets called every time you edit the code to, erm... parse the Ruby code into method definitions. So if you override it by defining your own, the RubyEdit no longer understands Ruby!
The usual convention is to use leading/trailing __underscores__ for "under the hood" Ruby methods which are likely to cause name collisions - but it seems DSPr like to keep us on our toes!
It breaks the RubyEdit in a rather, erm... interesting way. After a bit of digging, I discovered that RubyEdits already have a method called "parse". It gets called every time you edit the code to, erm... parse the Ruby code into method definitions. So if you override it by defining your own, the RubyEdit no longer understands Ruby!
The usual convention is to use leading/trailing __underscores__ for "under the hood" Ruby methods which are likely to cause name collisions - but it seems DSPr like to keep us on our toes!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
Re: If you're ever writing a parser in Ruby...
It's exactly that what I meant with careless integration on another "forum". The famous "@x" (a RubyEdit input named "x") is another example, internally reserved by DSPR without letting us know or protecting against us using it (luckily resolved in FS4!).
Should have taken you some time to realize it
Should have taken you some time to realize it
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: If you're ever writing a parser in Ruby...
I really ought to check out my old "Ruby hit-list" to see what's been fixed and what needs reporting. I've had a few crashes from bog-standard methods like .dup and .clone - the versions inherited from Object don't work so well (in 3.0.6) for some of the objects that wrap GDI+ pointers!
Mind you, I do get a rather perverse sense of enjoyment out of hacking my around them!
Mind you, I do get a rather perverse sense of enjoyment out of hacking my around them!
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Don't stagnate, mutate to create!
-
trogluddite - Posts: 1730
- Joined: Fri Oct 22, 2010 12:46 am
- Location: Yorkshire, UK
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 84 guests