[PD-dev] makefilename crash

Mathieu Bouchard matju at sympatico.ca
Mon Jan 10 00:22:15 CET 2005


On Sat, 8 Jan 2005, Tim Blechmann wrote:

> > Plus I'd rather have [makefilename] be named differently, because it
> > clearly gets used for much more than just filenames. maybe
> > [formatsymbol]. I'd suggest [sprintf] if not for nameclashes.
> sprintf is a wonderful cyclone object ... with type-checking ...

And so is [rubysprintf]. well, the object (class) itself is not wonderful
by itself, you have to attribute that to Ruby itself. Here's the source
code for [rubysprintf]:

class Sprintf < FObject
  def initialize(format) _1_symbol(format) end
  def _0_list(*a)
    a.each {|x| x=x.to_s if Symbol===x }
    send_out 0, :symbol, (sprintf @format, *a).intern
  end
  alias _0_float _0_list
  alias _0_symbol _0_list
  def _1_symbol(format) @format = format.to_s end
  install "rubysprintf", 2, 1
end

that's it. and it does full type-checking too. Of course, the same can be
done with pyext, and maybe even in less lines (the Ruby external isn't
particularly polished... I'll be working on it soon enough)

_____________________________________________________________________
Mathieu Bouchard -=- Montréal QC Canada -=- http://artengine.ca/matju





More information about the Pd-dev mailing list