From: Ara.T.Howard@... Date: 2004-11-07T12:43:43+09:00 Subject: Re: using LDAP Controls in ruby-ldap On Sun, 7 Nov 2004, Sean E. Russell wrote: > --nextPart1581570.dOv9ppeehb > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > Content-Disposition: inline > > On Friday 05 November 2004 20:30, Jason Wold wrote: >>> You could try something like this >>> a =3D OpenSSL::ASN1::Sequence.new([OpenSSL::ASN1::Integer.new('10'), >>> OpenSSL::ASN1::OctetString.new('')]) >>> >>> control.value =3D a.to_der >> >> '10' needs to be just the integer 10, and then it works. > > I'd like to point out, for the record, that this is a perfect example of ho= > w=20 > type checking in a language is a good thing. alternatively the source for OpenSSL::ASN1::Integer#initialize might/should be written as def initialize arg arg = Integer arg ... end and all would be well. i think a good general rule for production code is to a) convert to the type you need, String, Integer, etc. b) duck-type by checking for methods but of course we never to that. i can say that, ultimately, i like the lack of type checking in ruby since i find many methods (say using a tklabel with the built-in logger class) just 'works' with the addition of a method or two. it would be a shame to lose this flexiblity. i don't think strong typing is all bad, but so many langauges get it wrong that the thought just makes me cringe. the ocaml compiler sure is impressive tough. if i started out that way i might be a strong typing fan but... i guess i think strong typing without type inference is evil. i also hate getting 'int-ified' by c compilers... kind regards. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | When you do something, you should burn yourself completely, like a good | bonfire, leaving no trace of yourself. --Shunryu Suzuki ===============================================================================