#ruby-lang - Sun 25 Mar 2007 between 17:01 and 17:13

NY Lost Funds



mitsuhikobut that's not the definition of a metaclass why it's called singleton in ruby
dmdI'm trying to POST something using Net::HTTP::Post.new and it's urlencoding what i've set in set_form_data (specifically, [ and ] characters) ... how can I tell it to just send what i'm literally putting in quotes?
psticknealthough go into any other programming language and ask about singletons--they'll redirect you to the GoF pattern ^^
hal_9000mitsuhiko, we don't really use the term 'metaclass' in ruby, and a singleton class is different
mitsuhikohal_9000: that's what i tried to explain above
hal_9000mitsuhiko, sorry, i didn't read back far enough
eventualbuddhaah, i see where i got confused. why's metaid.rb defines a method called `metaclass' that returns the singleton
mitsuhikoeventualbuddha: well. then it's _why's fault
a metaclass looks like this: http://paste.pocoo.org/show/1273/ (warning, python3 ahead)
eventualbuddhamitsuhiko: so FooType inherits from type, and then you define the metaclass of Foo to be FooType
mitsuhikoeventualbuddha: type is in python the base class of classes. by inheriting from it i create a new class class
which i then define as metaclass for Foo
eventualbuddhai remember perusing Ruby's source and seeing a "you can't inherit from Class" error message. i guess that restriction would have to be removed before ruby could do that
mitsuhikothat metaclass=FooType is python3 syntactic sugar, it's __metaclass__ = FooType in python2
eventualbuddha: well. must ruby include that feature?
singletons are nice too ;)
eventualbuddhamitsuhiko: i'm trying to think of a use case
mitsuhikoeventualbuddha: for metaclasses?
there are many
Xifmitsuhiko: still the same thing, basically
mitsuhikoi don't know a single python library of mine that doesn't use metaclasses
Xif: no. it's not
Xif: not even basically
Xifmitsuhiko: huh? it's syntactic sugar for what Python2 does.
mitsuhikoXif: try to create a bunch of classes that have a given class as type
eventualbuddhai'm getting an image of a stack of turtles...
mitsuhikoXif: what are we talking about atm? :)
Xifmitsuhiko: whether P3k added something significant
in the MC dept.
eventualbuddhamitsuhiko: he's saying that the python2 and python3 versions are the same
functionally
mitsuhikoeventualbuddha: well. beside the new __class_prepare__ it's the same
python3 adds a bunch of new cool stuff but breaks many, many libraries
it's worse than ruby2
Xifmitsuhiko: my point is that what you showed doesn't add anything significant over what Python2 does.
so I don't see the justification for breaking codebase.
mitsuhikoXif: no. that example is pretty the same
Xif: well. print is a function now for example. (metaclass=Foo) doesn't work in python2 either
you have to use __metaclass__
unicode are now default strings. the io level works different

Page: 1 8 15 22 29 36 43 50 57 

IrcArchive

NY Lost Funds