The Artima Developer Community
Sponsored Link

Agile Buzz Forum
RabidDankNutmeg

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
RabidDankNutmeg Posted: Jan 8, 2008 7:34 PM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: RabidDankNutmeg
Feed Title: Travis Griggs - Blog
Feed URL: http://www.cincomsmalltalk.com/rssBlog/travis-rss.xml
Feed Description: This TAG Line is Extra
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Travis Griggs - Blog

Advertisement

I just published a package by said post title to the Open Repository. Here's its package comment.

A terrible package name, I know. But it caught your attention, huh?

It is an anagram for "bad argument kind", which is an error that you may have seen if you've done much DLLCC programming under VW. Two examples:

1) You have a function

<C: void function(float number)>

If you pass a SmallInteger, or a Double, or a Float to this, the VM's DLLCC marshalling magic below primitive 395 will do the right thing. And it will do it faster and with less garbage than if you littered your code with asFloats. But if you pass it a Fraction or a ScaledDecimal, then it will blow up. We like Smalltalk transcendental numbers. We'd like to not have to worry about this. It may be slower, but it should work.

2) You have a function

<C: void function(char* string)>

Pass it a string, and all is good. But what if one of those UserMessages makes its way there? Should you have to put asString in front of every thing. Same problem as above, just another common example.

What this package does is put in place a special handler in the externalAccessFailedWith: code, which notes when the error is of this type, backs the stack back up to the method where things started, sends a recastAsCType: to the offending object, passing along the type, and then lets it try again. If multiple arguments are are encountered, it will repeat for each one.

There's probably a chance for infinite spin, I intend to fix that when I concoct a good test case. It works great for OpenGL and Cairo though.

Basically I wrote this to come up with a more general/encapsulated solution to problems I ran into with CairoGraphics and saw being repeated in the OpenGL packages.

Michael Lucas-Smith deserves some credit for inspiring me to take the time to write this. Thank you. Bob Westergaard deserves some credit for letting me bounce a couple of the ideas off of him. Alan Knight too.

Read: RabidDankNutmeg

Topic: Two problems collaborating Previous Topic   Next Topic Topic: Acting 'as if' is self-fulfilling

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use