IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.21 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-07-04
[15:53]<dzdyzzz-wjzc>doh, mutable.
[15:53]<snzranwnfks>damieng-work: http://www.chrishowie.com/2006/07/04/sealed-classes-in-net-but-why/
[15:53]<mjzymygo>damieng: which is what I like to do *evil laugh*
[15:53]<snzranwnfks>damieng-work: if a class' methods are sealed, you can hide them with "new". but if you use a "string" object reference to invoke them, it will call String.Foo(), not StringDerived.Foo()
[15:54]<dzdyzzz-wjzc>yes i know this
[15:54]<snzranwnfks>damieng-work: it's like overloading a non-virtual method in C++. the method you call depends on the object reference/pointer type you're calling with
[15:54]<mjzymygo>SerajewelKS: thats a compiler choice by the c# team.
[15:54]<dzdyzzz-wjzc>anyone who uses "new" on a method is asking to be shot in the foot
[15:54]<snzranwnfks>damieng-work: that's not really the point of deriving string
[15:55]<dnn2nd>damieng-work: not in a versioning sense
[15:55]<dzdyzzz-wjzc>why would you wan to derive string?
[15:55]<mjzymygo>IL supports most-derived call, and least derived call
[15:55]<snzranwnfks>damieng-work: that only serves to show "see, you can't make it mutable". the real idea is to add extra properties that you might need, while still allowing the thing to be a string.
[15:55]<dzdyzzz-wjzc>but ToLower() to Upper() Trim() would then return a normal string
[15:55]<snzranwnfks>damieng-work: yes
[15:56]<dzdyzzz-wjzc>so it would be pretty useless
[15:56]<snzranwnfks>damieng-work: i was working on a java project where i came in handy
[15:56]<snzranwnfks>damieng-work: it*
[15:56]<snzranwnfks>damieng-work: of course there i had to create a new class and implement CharSequence, Comparable, etc... and map them
[15:56]<dzdyzzz-wjzc>sounds like more trouble than it's worth
[15:57]<dzdyzzz-wjzc>anyway, my gf is waiting for me to pick her up for lunch
[15:57]<dzdyzzz-wjzc>bbl
[15:57]<snzranwnfks>the cool part would be where you could annotate a string with properties of your own, pass it into a system object later, and when it came back you could read those properties off again.
[15:58]<rwyfcygs>You can do it with JSCript.. .I think you can do it with .NET objects, in Monad
[15:58]<dza|zdvnz>SerajewelKS: but then it's no longer a string..
[15:59]<dza|zdvnz>SerajewelKS: about the virtual thing.. if String were unsealed, one method would be virtual that you use very often
[15:59]<snzranwnfks>mac|gyver: but to the system it is. because even if you "overrided" some methods, you'd only be hiding them
[15:59]<dza|zdvnz>the .ctor
[15:59]<snzranwnfks>mac|gyver: ctor being?
[15:59]<dza|zdvnz>constructors
[15:59]<zyccus>SomeString = "hello, world" ... SomeString.instance_variable_set(:@tag, "bar") ... SomeString.instance_variable_set(:@tag) => "bar"
[16:00]<snzranwnfks>mac|gyver: how would that be a security/mutability issue
[16:00]<zyccus>last set should be get :}
[16:00]<dza|zdvnz>it's a performance issue
[16:00]<snzranwnfks>mac|gyver: couldn't the ctor be marked sealed somehow?
[16:00]<dza|zdvnz>no
[16:01]<dza|zdvnz>uh
[16:01]<dza|zdvnz>hm
[16:02]<snzranwnfks>mac|gyver: as far as "not being a string" keep in mind that because all of the methods would be sealed, and the system classes would use it as string/String, they would be calling the methods in String -- not the new ones hiding them. a hidden method is not an overridden method.
[16:03]<snzranwnfks>mac|gyver: the CLR could perform the same method optimizations there
[16:03]<dza|zdvnz>yeah but I can't see why you need an object derived from string
[16:03]<snzranwnfks>mac|gyver: wait, C#/.NET lets you define methods for casting, right?
[16:04]<dza|zdvnz>yeah
[16:04]<dza|zdvnz>explicit and implicit casting operator
[16:04]<dza|zdvnz>s
[16:04]<dza|zdvnz>implicit operators can be confusing to users of your api, so watch out with those :)
[16:04]<snzranwnfks>mac|gyver: so... one could just define an implicit cast-to-string :S
[16:04]<dza|zdvnz>yeah
[16:04]<snzranwnfks>mac|gyver: well... uh...
[16:05]<dza|zdvnz>so?
[16:05]<dza|zdvnz>you can't store additional data that way
[16:05]<snzranwnfks>mac|gyver: so that kind of makes my point moot.
[16:05]<snzranwnfks>mac|gyver: well true
[16:05]<snzranwnfks>mac|gyver: yeah i suppose that is the point isn't it
[16:05]<dza|zdvnz>after that step, it's still a string
[16:06]<snzranwnfks>yeah forgot about that part. my point stands then.
[16:06]<dza|zdvnz>but if you attach more data to a string, it's no longer a string but a business object
[16:06]<cu2rzdrdugv>why i have a different look when I design, and when I run program ?
[16:06]<snzranwnfks>kubaZygmunt: gremlins
[16:07]<lcs>rotfl
[16:07]<cu2rzdrdugv>nooo
[16:07]<cu2rzdrdugv>:) i dont believe in that
[16:07]<cu2rzdrdugv>so how can i set XP style to my app.
[16:08]<lcs>you cannot
[16:08]<snzranwnfks>kubaZygmunt: oh, XP style. google for "visual basic xp style widgets"
[16:08]<snzranwnfks>kubaZygmunt: if you add a line to your program's XML manifest, they will show up. it was a common hack for VB6 apps that still works (IIRC) with .NET apps.
[16:08]<cu2rzdrdugv>visual basic and C# :) nice
[16:08]<lcs>hm
[16:09]<snzranwnfks>kubaZygmunt: visual basic 6, i said. it will also work for *all* .NET languages. VB.NET, C#, J#, Boo...
[16:09]<snzranwnfks>kubaZygmunt: anything that uses winforms
[16:10]<snzranwnfks>kubaZygmunt: there are a myriad of ways to implement this hack. pick your poison and try it.
[16:11]<lcs>why to do such thing at the first place?
[16:11]<snzranwnfks>pks: what?
[16:11]<cjmgrug>isnt there a Application.EnableVisualStyles(bool) method???
[16:11]<cjmgrug>oops sorry, it take no arguments
[16:12]<cjmgrug>ie Application.EnableVisualStyles();
[16:12]<snzranwnfks>ah, interesting. i don't use SWF much (gtk# primarily).
[16:15]<lcs>SerajewelKS: why to use force user to work with xp style
[16:15]<lcs>SerajewelKS: if someone wants to work with it, then he would have enabled it at the first place
[16:16]<lcs>then all app would have xp style controls
[16:16]<lcs>apps*
[16:16]<lcs>or am i wrong?
[16:17]<snzranwnfks>pks: .NET apps by default don't use any style at all
[16:17]<snzranwnfks>pks: you have to enable them at all. if the user has selected the Windows Classic style, they won't change to XP style. but if you don't enable styles then they'll always look like Classic widgets.
[16:17]<lcs>hm, true
[16:18]<lcs>i've just checked
[16:18]<lcs>somehow i didnt notice that
[16:18]<lcs>so, as CodeRun said, Application.EnableVisualStyles() should do the trick
[16:18]<snzranwnfks>yup
[16:19]<cjmgrug>;)
[16:50]<jnpys>Hey everybody :)
[16:55]<cjmgrug>hey!
[16:58]<mjzdmdgo|busd>cool.... http://www.theregister.co.uk/2006/07/04/snow_in_brum/
[16:58]<mjzdmdgo|busd>snow in July...
[17:00]<mjzdmdgo|busd>http://www.theregister.co.uk/2006/07/04/microsoft_ec_fines/
[17:02]<cjmgrug>question : this must have been a problem encountered by everyone who's ever thought about data storage : I am writing a simple client which stores and retrieves data from a database on another machine. If multiple people are using the client, and if they perform operations, simultaneously, will they get invalid/corrupt data?
[17:03]<dzdyzzz-wjzc>how will multiple people be using your client?
[17:03]<dzdyzzz-wjzc>and what exactly is client
[17:03]<rwyfcygs>answer : Not if you write your software properly







