code logs -> 2015 -> Sat, 21 Nov 2015< code.20151120.log - code.20151122.log >
--- Log opened Sat Nov 21 00:00:26 2015
00:08 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
00:32 Derakon[AFK] is now known as Derakon
00:38 Emmy is now known as Emmy-zZz
00:45 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
00:45 Thalass [thalass@Nightstar-pnj.8hv.135.63.IP] has joined #code
00:45 mode/#code [+o Thalass] by ChanServ
02:20 Kindamoody[zZz] is now known as Kindamoody
03:24 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [[NS] Quit: brb]
03:25 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code
03:26 mode/#code [+ao McMartin McMartin] by ChanServ
03:35 celticminstrel [celticminst@Nightstar-uce74q.dsl.bell.ca] has quit [Ping timeout: 121 seconds]
03:38 celticminstrel [celticminst@Nightstar-uce74q.dsl.bell.ca] has joined #code
03:38 mode/#code [+o celticminstrel] by ChanServ
03:47 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has joined #code
04:03 Thalass [thalass@Nightstar-pnj.8hv.135.63.IP] has quit [[NS] Quit: *flops bedward*]
04:40 Kindamoody is now known as Kindamoody[zZz]
05:13 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
06:05 anion [idonob@Nightstar-3cu28l.vs.shawcable.net] has joined #code
06:05 anion [idonob@Nightstar-3cu28l.vs.shawcable.net] has quit [Connection closed]
06:07 Meatyhandbag [sebastianfe@Nightstar-g18.15e.224.136.IP] has joined #code
06:13 Meatyhandbag [sebastianfe@Nightstar-g18.15e.224.136.IP] has quit [Client exited]
06:30 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has quit [[NS] Quit: Leaving]
06:33 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
07:23 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has joined #code
07:52 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
07:59 celticminstrel is now known as celmin|sleep
08:31 catadroid [catalyst@Nightstar-0cqvav.skybroadband.com] has quit [Ping timeout: 121 seconds]
08:36 Kindamoody[zZz] is now known as Kindamoody
09:14 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has joined #code
09:14 mode/#code [+o Crossfire] by ChanServ
10:15 Kindamoody is now known as Kindamoody|afk
10:22 macdjord [macdjord@Nightstar-ahbhn1.cable.rogers.com] has joined #code
10:22 mode/#code [+o macdjord] by ChanServ
10:34 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has joined #code
11:18 ion [Owner@Nightstar-3cu28l.vs.shawcable.net] has quit [Ping timeout: 121 seconds]
11:45 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has joined #code
11:54 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has quit [[NS] Quit: Bye]
12:11 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
13:38 Netsplit *.net <-> *.split quits: @Alek, @Tamber, @gnolam, @himi, @macdjord, @Namegduf, @Xon, ricer, @celmin|sleep, @McMartin, (+8 more, use /NETSPLIT to show all of them)
13:38 Netsplit over, joins: @jeroud, @Alek, Tamber, @froztbyte, @iospace, @macdjord, @himi, @gnolam, &McMartin, @Syloq (+8 more)
13:38 mode/#code [+o Tamber] by ChanServ
13:39 mac [macdjord@Nightstar-ahbhn1.cable.rogers.com] has joined #code
13:39 mode/#code [+o mac] by ChanServ
13:41 macdjord [macdjord@Nightstar-ahbhn1.cable.rogers.com] has quit [Ping timeout: 121 seconds]
15:03 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has joined #code
15:04 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has quit [[NS] Quit: Bye]
15:15 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has joined #code
15:28 Thalass [thalass@Nightstar-pnj.8hv.135.63.IP] has joined #code
15:28 mode/#code [+o Thalass] by ChanServ
15:28
<@Thalass>
https://twitter.com/elonmusk/status/667517215390863360 <-- Anyone in here want a job? :P
16:10 Derakon [chriswei@Nightstar-5mvs4e.ca.comcast.net] has joined #code
16:10 mode/#code [+ao Derakon Derakon] by ChanServ
16:35 catadroid` [catalyst@Nightstar-vncv48.dab.02.net] has joined #code
16:36 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has quit [Connection closed]
16:56 Thalass [thalass@Nightstar-pnj.8hv.135.63.IP] has quit [Ping timeout: 121 seconds]
16:57 Thalass [thalass@Nightstar-pnj.8hv.135.63.IP] has joined #code
16:57 mode/#code [+o Thalass] by ChanServ
16:58 catadroid` is now known as catadroid
16:59 catadroid` [catalyst@Nightstar-pbq.qom.132.82.IP] has joined #code
17:02 catadroid` [catalyst@Nightstar-pbq.qom.132.82.IP] has quit [[NS] Quit: Bye]
17:02 catadroid [catalyst@Nightstar-vncv48.dab.02.net] has quit [Ping timeout: 121 seconds]
17:14 Thalass [thalass@Nightstar-pnj.8hv.135.63.IP] has quit [Ping timeout: 121 seconds]
17:16 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
17:16 mode/#code [+qo Vornicus Vornicus] by ChanServ
17:47 celmin|sleep is now known as celticminstrel
18:24 Alek [Alek@Nightstar-ld7us0.il.comcast.net] has quit [Ping timeout: 121 seconds]
18:27 Alek [Alek@Nightstar-ld7us0.il.comcast.net] has joined #code
18:27 mode/#code [+o Alek] by ChanServ
18:44 catadroid [catalyst@Nightstar-pbq.qom.132.82.IP] has joined #code
18:55 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code
18:59 catadroid [catalyst@Nightstar-pbq.qom.132.82.IP] has quit [[NS] Quit: Bye]
19:22 Emmy-zZz is now known as Faymmy
20:42 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has joined #code
20:43 mode/#code [+o Crossfire] by ChanServ
20:43 Kindamoody|afk [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has quit [Client exited]
20:43 Kindamoody|autojoin [Kindamoody@Nightstar-0lgkcs.tbcn.telia.com] has joined #code
20:43 mode/#code [+o Kindamoody|autojoin] by ChanServ
20:44 Kindamoody|autojoin is now known as Kindamoody
20:50
<@Azash>
Rubyyyyyyyyyyyyyyyyyyyyyyyyyy
20:50
<@Azash>
For those not familiar with ruby, you have two separate types of strings
20:50
<@Azash>
'string' and :symbol
20:51
<@Azash>
After 30 mins of work I discovered that no, symbols in fact print without the :
20:51
<@Azash>
And due to the VAST FUNCTIONAL DIFFERENCES of "string" and "string with smaller memory footprint"
20:51
<@Azash>
You can't compare them.
20:51
<@Azash>
This has happened to me probably half a dozen times by now and every time I'm confused by the sheer stupidity of the whole idea
20:52
<@Azash>
Every time you expect textual data god forbid you forget to add a million casts to string after every variable reference
20:52
<@Azash>
Because then someone else 30 function calls higher up actually uses a symbol and you can just hear the noise of wrenches in the gears
21:18 thalass [thalass@Nightstar-283.o7s.158.104.IP] has joined #code
21:18 mode/#code [+o thalass] by ChanServ
21:18 thalass is now known as Thalass|pyroman
21:32 Thalass|pyroman is now known as Thalass
21:34 * Thalass pokes at arduino, ponders countdown timers and such.
21:51
<~Vornicus>
I never had that flavor of trouble with either ruby or postscript (which also has symbols)
21:56
<&jerith>
Azash: A symbol isn't a string. It's a name.
21:57
<&ToxicFrog>
Yeah, symbols are more like enum values than like strings.
22:16
<@Azash>
But that they are used in the language in general rather than as an aspect of a specific language feature with its limited and clear areas of application, in my opinion, means that they should not be made forcibly complicated
22:16
<@Azash>
That is, if you allow free application, you should not deny the simplest case of easing such application
22:17
<@Azash>
Of course it may be a quirk of this particular project that symbols have been given maximal approximation to strings (with things like strings and symbols being equal as hash keys)
22:18
<&jerith>
Hash keys are one of the things symbols are really useful for.
22:18
<&jerith>
But you shouldn't be using symbols and strings as keys in the same hash.
22:19
<@Azash>
I'm just the maintainer here
22:21
<&jerith>
You should be complaining about how the symbols are used, not about the symbols themselves.
22:21
<&jerith>
There's a lot I dislike about Ruby, but symbols are actually rather good.
22:22
<&jerith>
They come from lisp, IIRC.
22:22
<@celticminstrel>
Lisp has symbols?
22:22
<@celticminstrel>
That's not the "word syntax, is it?
22:23
<&McMartin>
No, it's the 'whatever one.
22:23
<@celticminstrel>
Ah...
22:23
<&McMartin>
Or rhater
22:23
<&McMartin>
What is returned from 'whatever is the symbol named "whatever"
22:23
<&jerith>
In clojure, symbols are colon-prefixed.
22:23
<&McMartin>
That is actually something else, that CLISP has and Scheme does not
22:23
<&jerith>
Is it? Hrm.
22:23
<&McMartin>
Those are a subclass of special symbols guaranteed to always evaluate to themselves and thus that need not be quoted
22:24
<&McMartin>
The symbol + must certainly does not evaluate to itself, normally
22:24
<&McMartin>
It evaluates to the builtin function that sums its arguments.
22:24 Thalass is now known as Thalass|buildingasnowblower
22:24
<&McMartin>
... I want to say :whatever symbols are "keywords"?
22:24
<&ToxicFrog>
McMartin: yes
22:24
<&McMartin>
I have an actual LISP book around here somewhere
22:24
<&McMartin>
Ok then. Keywords are a subset of symbols.
22:25
<&jerith>
Ah, right.
22:25
<&ToxicFrog>
ser=> (map type [:foo 'foo "foo"])
22:25
<&ToxicFrog>
(clojure.lang.Keyword clojure.lang.Symbol java.lang.String)
22:28
<&jerith>
In that case, I'll modify what I said before. Ruby symbols come from lisp keywords.
22:29
<@Azash>
jerith: Unfortunately even lacking project design does not convince me that it's reasonable to not be able to compare two different text representations
22:29
<@Azash>
No matter what the internal differences are
22:29
<&ToxicFrog>
Symbols are not a text representation.
22:29
<&jerith>
Azash: Symbols are not text.
22:30
<&ToxicFrog>
They are closer to named enums, or even struct field names.
22:30
<&jerith>
Unless you also consider variable names to be text.
22:30
<&jerith>
They have a textual representation for convenience, the same way numbers do.
22:31
<@Azash>
http://api.rubyonrails.org/classes/ActiveSupport/HashWithIndifferentAccess.html
22:32
<@Azash>
Not only is there a precedent for at least some equivalence between the two, but the fact that I can freely to :derp.to_s to generate 'derp' means that the symbol name is readily accessible
22:33
<&jerith>
Azash: That's the same idea as turning 1 into "1".
22:33
<&jerith>
irb(main):001:0> 1.to_s
22:33
<&jerith>
=> "1"
22:34
<@Azash>
When I said "no matter what the internal differences are" I was addressing that symbols are not actual representations of text, I am aware of that. And that is a false comparison because symbols are still formed using text, not numeric values
22:35
<&ToxicFrog>
So are variable names.
22:35
<&jerith>
Yes. Symbols are names.
22:36
<&McMartin>
Traditionally, Lisp symbols were actually enums
22:36
<&jerith>
Other languages (Python, for example) use strings in many of the places Ruby uses symbols, which is suboptimal in many ways.
22:37
<@Azash>
I am aware of why symbols are used, jerith
22:37
<&jerith>
For example, comparison is not constant-time.
22:37
<&McMartin>
Once the symbol/string membrane became permeable, symbols became interned strings compared by pointer value.
22:38
<&jerith>
Azash: Then what is your complaint?
22:39
<&McMartin>
jerith: The software Azash is maintaining is being indifferent as to using symbols vs strings consistently within a single composite object.
22:39
<@Azash>
I am saying that I am not convinced there is a good reason to not allow direct comparison of ruby strings and symbols, given that there is already a strong precent of using them interchangeably, although I will concede that that is only from the most notable application of ruby and not the language itself
22:39
<&McMartin>
That is at least as bad as mixing spaces and tabs, and possibly worse.
22:39
<@Azash>
(rails using HashWithIndifferentAccess to provide request parameters)
22:40
<&ToxicFrog>
Azash: that "precedent", AFAICT, exists only within this terrible codebase you've been stuck with, not the language as a whole
22:40
<&McMartin>
Well
22:40
<&McMartin>
That terrible codebase is Rails
22:40
<&McMartin>
aka "the only reason people use Ruby"
22:40
<&ToxicFrog>
And I would be shocked -- and horrified -- if (== :foo "foo")
22:41
<@Azash>
I'm not going to say it a third time, unfortunately
22:41 Faymmy [M@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds]
22:41
<&jerith>
Azash: PHP allows direct comparison of strings and numbers, which most people agree is a terrible idea.
22:42
<&McMartin>
Perl gave us "0 but true"
22:42
<@Azash>
Given that the general air right now is not refuting what I say but entirely ignoring what I say, I think I'm going to bow out
22:42
<@Azash>
Thank you for the discussion
22:42
<&jerith>
Azash: I'm confused about what you're trying to say.
22:43
<&jerith>
It seemed to be "symbols should be more like strings".
22:44
<&jerith>
As far as I can tell, the problem is with the code that tries to use strings and symbols interchangeably, which I maintain is a problem with the code.
22:45
<&ToxicFrog>
Yeah, AFAICT what you're saying is "symbols should be eqv to strings, because this specific project jumps through hoops to make them behave equivalently anyways"
22:45
<&ToxicFrog>
If that's not what you're saying, please correct me
22:46
<&jerith>
`"foo" == :foo` is the same class of comparison as `"1" ==1`.
22:46
<@Azash>
I am not going to, because, first, I have pointed out differently a couple of times now and second, I have already said I am dropping the subject and do not intend to go back on that
22:47
<&jerith>
"I am saying that I am not convinced there is a good reason to not allow direct comparison of ruby strings and symbols"
22:47
<&jerith>
We're trying to explain that there *are* good reasons.
22:47
<&jerith>
Starting with "strings and symbols are very different things".
22:47
<&jerith>
But you seem to be ignoring that.
22:51 Netsplit *.net <-> *.split quits: @iospace, @Thalass|buildingasnowblower, @Syloq, @froztbyte, @Vornicus, @celticminstrel, @mac, @Xon, @himi, @Azash, (+9 more, use /NETSPLIT to show all of them)
22:53 Netsplit over, joins: gnolam
22:53 mode/#code [+o gnolam] by ChanServ
22:53 Netsplit over, joins: jeroud, Alek, froztbyte, iospace, Vornicus, mac, Thalass|buildingasnowblower, himi, Syloq, Azash (+5 more)
22:53 720AABZZE [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has joined #code
22:53 Netsplit over, joins: @Tamber, &McMartin, @celticminstrel
22:53 ServerMode/#code [+oooooqooooooooaooo Syloq froztbyte Azash iospace Namegduf Vornicus Vornicus jeroud Xon mac Thalass|buildingasnowblower Alek himi 720AABZZE McMartin McMartin Tamber celticminstrel] by *.Nightstar.Net
22:54 Vornotron [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
22:54 froztbyte [froztbyte@Nightstar-frrora.za.net] has quit [Ping timeout: 121 seconds]
22:55 Netsplit *.net <-> *.split quits: @iospace, @Thalass|buildingasnowblower, @Syloq, @Vornicus, @celticminstrel, @mac, @Xon, @himi, @Azash, @720AABZZE, (+9 more, use /NETSPLIT to show all of them)
22:55 Netsplit over, joins: jeroud, Alek, iospace, mac, Thalass|buildingasnowblower, Syloq, Azash, Namegduf, gizmore, ricer (+2 more)
22:55 froztbyte [froztbyte@Nightstar-pk8.hnb.10.85.IP] has joined #code
22:55 Netsplit over, joins: Tamber, himi, 720AABZZE, McMartin
22:55 Netsplit over, joins: Vornotron, @celticminstrel
22:55 ServerMode/#code [+oooooooooooaooo Syloq Azash iospace Namegduf jeroud Xon mac Thalass|buildingasnowblower Alek himi 720AABZZE McMartin McMartin Tamber celticminstrel] by *.Nightstar.Net
22:55 mode/#code [+o froztbyte] by ChanServ
22:56 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [Ping timeout: 121 seconds]
22:56 McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code
22:56 mode/#code [+ao McMartin McMartin] by ChanServ
22:56
<&ToxicFrog>
McMartin: of course, something can be so useful that everyone uses it while also being a pile of terrible hacks internally, and that is in fact exactly what I've heard about Rails from multiple sources, sooooo
22:56 720AABZZE [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has quit [Ping timeout: 121 seconds]
22:56 Namegduf [namegduf@Nightstar-rjh.rpa.226.188.IP] has quit [Ping timeout: 121 seconds]
22:56
<&jerith>
Breaking the network seems like a rather extreme way to get out of a conversation. :-P
22:57
<@Azash>
Cute
22:58
<@Azash>
Fine, if you're going to be that way, I'll sum it up as clearly as I can
22:58
<&jerith>
I've heard that Rails is less of a horrible hack than it used to be.
22:58
<&jerith>
But it's still a horrible hack.
22:58 Kindamoody is now known as Kindamoody[zZz]
22:58
<&jerith>
As are most web frameworks.
22:59
<&jerith>
Azash: If you don't want to discuss this anymore, we don't have to.
23:00
<&jerith>
I'm not trying to be hostile, I'm just confused.
23:00
<@Azash>
Considering you're taunting me about dropping it, I don't see much more option than clarifying it
23:01
<&jerith>
That was a poor attempt at humour, not a taunt.
23:01
<&jerith>
I would like to understand, but you're not under any obligation.
23:02
<@Azash>
What I said was: I am aware of the function symbols serve. I do not consider "symbols and strings should be comparable" to be a valid counterpart to "integers and strings should be comparable", because even beyond implementation integers and strings are fundamentally different, rather than the siblinghood of symbols and strings. Symbols contain their own name already and thus should not be difficult to add .eql? for and to. In addition, and this is the part that I sai
23:02
<&jerith>
Cut off at "part that I sai".
23:03
<@Azash>
that I said twice and nobody noticed or cared, Rails sets a very strong precedent for interchangeability with its introduction of HashWithIndifferentAccess, a structure that does equate symbols and strings. It's used heavily in the framework, most notable in the most common hash it features, the parameters hash passed with every request.
23:03
<@Azash>
The fault may not be in Ruby, but I still feel that the complain is valid toward Rails folks who do have the option of overloading Symbol and String to be comparable, given they are sending strong signals that comparability is the convention
23:03
<@Azash>
There
23:03
<&jerith>
Ah.
23:04
<&jerith>
Well, from a practical standpoint making "foo" and :foo equal would require changing how symbols are hashed.
23:05
<&jerith>
Which would negate many of their benefits over strings.
23:05
<@Azash>
Hm, I suspect it wouldn't, really
23:06
<@Azash>
It is possible to add to existing classes in Rails or whatever else, and they already store internally their name
23:06
<@Azash>
At least, to the best of my knowledge
23:07
<@Azash>
Considering the wrapper class offers a .to_s method
23:08
<&jerith>
The hash method on Symbol comes from the C implementation on Object and basically just returns the object id.
23:09
<&jerith>
The hash method on String needs to inspect every character in the string.
23:10
<&jerith>
So the override on Symbol would either be orders of magnitude slower or it would have to stash an extra field on the object at some point.
23:11
<&jerith>
Either way, that has implications for everything that uses symbols.
23:11
<@Azash>
Well, what I mean is more that it's risk-prone to rely on comparing stuff with foo.to_s.eql? bar.to_s instead of foo.eql? bar
23:12
<@Azash>
It honestly doesn't, symbols don't have the .eql? method
23:12
<@Azash>
It would not impede existing functionality, and adding it would really only modify the wrapper class to do "if the parameter is a symbol, compare, if a string, .eql?"
23:13
<&jerith>
Also, it's possible that the Ruby interpreter special-cases symbols (because it's what names are made of) in ways that make such overloading problematic.
23:13
<@Azash>
Mmh
23:13
<@Azash>
Very maybe
23:13
<@Azash>
But looking at it I think the Symbol class is pretty much just a wrapper that acts like any other class
23:13 catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: ]
23:14
<&jerith>
There's no wrapper class here. To do what you're proposing in Rails (as opposed to doing it in Ruby itself) requires modifying the Symbol class directly.
23:15
<&jerith>
Even if there isn't any special-casing, there will be a lot of symbols already in existence by the time Rails gets the opportunity to change the behaviour.
23:16
<@Azash>
I'm referring to the class as a wrapper class, sorry
23:16
<@Azash>
Due to functionality very quickly disappearing into the actual implementation (C, I think?)
23:17
<&jerith>
Which means you'll have objects whose hash value changes over the course of their lifetime.
23:17
<&jerith>
Which is very bad news if anything relies on the hash value.
23:17
<@Azash>
I'm not quite following actually
23:18
<&jerith>
Let's say we have a symbol :foo with a hash value of 1 and a symbol :bar with a hash value of 2.
23:19
<@Azash>
What, exactly, do you mean by hash value? The value that the symbolic representation converts to?
23:19
<&jerith>
These symbols are created by the Ruby runtime system as part of startup.
23:19
<&jerith>
Maybe they're method names on some builtin objects.
23:20
<&jerith>
Imagine there's a hashtable with :foo and :bar as keys.
23:21
<&jerith>
(I'm thinking of something like Python's object dict, which maps attribute names to values. I don't know if Ruby works like that, but it likely does.)
23:22
<@Azash>
I'm mostly wondering if adding a method to the Symbol class is really going to change that behaviour at all
23:22
<&jerith>
When Rails comes along and replaces Symbol.hash to make equality with strings work, :foo suddenly has a hash value of 42 and :bar has a hash value of 111.
23:23
<@Azash>
Oh, no, no, that's not what I meant at all
23:23
<@Azash>
Not replacing anything
23:23
<&jerith>
So when you next look up :foo or :bar in that hashtable, you'll be looking in the wrong place.
23:23
<@Azash>
Symbol explicitly does not have a .eql? method, and I am suggesting that it would not be difficult to add one to conform it to the interchangeability theme, without modifying any existing code
23:23
<&jerith>
In order to have "foo" == :foo, you need "foo".hash == :foo.hash.
23:24
<@Azash>
Yes, but AFAIK adding an instance method to a class in Ruby does not modify the actual instances
23:24
<&jerith>
Otherwise hashtables break in slightly different ways.
23:24
<&jerith>
Azash: In general, yes.
23:25 Crossfire [Z@Nightstar-r9lk5l.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
23:26
<&jerith>
In this particular case, the semantics required for equality and hash values mean you can't change one without changing the other.
23:28
<@Azash>
I'm not talking about changing anything like that, though
23:28
<@Azash>
My suggestion would be purely a convenience method
23:29
<&jerith>
You'd have to call it .string_eq or something, then.
23:29
<&jerith>
Because .eql? is used by Hash to decide whether two things are equal.
23:31
<@Azash>
jerith: But Symbol itself does not have an implementation for it
23:31
<@Azash>
Meaning you can defer to super as appropriate
23:32
<&jerith>
It inherits the implementation from Object, which is based on object identity.
23:32
<@Azash>
Yep
23:32
<&jerith>
Replacing .eql? is trivial.
23:33
<&jerith>
Replacing it in a way that doesn't break stuff is not.
23:33
<@Azash>
def eql?(foo)\n if foo.is_a? String\n return self.to_s.eql? foo\n else\n return super foo\n end\n end
23:34
<&jerith>
If `a.eql? b` is true, `a.hash == b.hash` *must* be true.
23:34
<&jerith>
That's the the problem here.
23:34
<@Azash>
Hm
23:35
<&jerith>
Otherwise the hashtable implementation tries to put things that are equal in different places.
23:36
<&McMartin>
Or looks for something that's there in the wrong place.
23:36
<&jerith>
Yes.
23:37
<&jerith>
"foo" goes in bucket 12, :foo goes in bucket 1337, but "foo" == :foo.
23:37
<&jerith>
This is very bad news if you want Hash to work.
23:38
<&jerith>
Even worse is if :foo went in bucket 1337 when it was put in the hashtable but belongs in bucket 12 later when you try to find it.
--- Log closed Sun Nov 22 00:00:41 2015
code logs -> 2015 -> Sat, 21 Nov 2015< code.20151120.log - code.20151122.log >

[ Latest log file ]