Re[2]: [Hugs-users] Record puns, time for removal?

Hello Simon, Monday, October 30, 2006, 3:11:23 PM, you wrote:
I always thought it was a mistake to remove record puns in H98. I would not be against re-introducing them into GHC, since they appear to remain in Hugs and are in Yhc.
what you (and all) think about wildcarded puns: data Command = Command { cmd_name :: !String , cmd_arcspec :: String , cmd_arclist :: [FilePath] , cmd_arcname :: FilePath , cmd_arc_filter :: !(FileInfo -> Bool) , cmd_filespecs :: ![String] , cmd_added_arcnames :: !(IO [FilePath]) , cmd_diskfiles :: !(IO [FileInfo]) , cmd_subcommand :: !Bool .... } process_cmd (Command{*}) = do print cmd_name ... because Haskell encourage using of structure name as part of field's name, this will not create mess (at least for my programs), it will work like Pascal's 'with' operator -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

Funny that you should mention this idea. I spent last night and this morning implementing it in ghc. But I use '..' instead of '*'. The punning is available both for expressions and patterns. I am of two minds about this extension. It introduces bound variables without mentioning the variable at the binding site. This can be error prone. (But 'import' has similar problems.) Dubious as it is, when using large records it reduces the amount of boiler place code significantly. -- Lennart On Oct 30, 2006, at 16:20 , Bulat Ziganshin wrote:
Hello Simon,
Monday, October 30, 2006, 3:11:23 PM, you wrote:
I always thought it was a mistake to remove record puns in H98. I would not be against re-introducing them into GHC, since they appear to remain in Hugs and are in Yhc.
what you (and all) think about wildcarded puns:
data Command = Command { cmd_name :: !String , cmd_arcspec :: String , cmd_arclist :: [FilePath] , cmd_arcname :: FilePath , cmd_arc_filter :: !(FileInfo -> Bool) , cmd_filespecs :: ![String] , cmd_added_arcnames :: !(IO [FilePath]) , cmd_diskfiles :: !(IO [FileInfo]) , cmd_subcommand :: !Bool .... }
process_cmd (Command{*}) = do print cmd_name ...
because Haskell encourage using of structure name as part of field's name, this will not create mess (at least for my programs), it will work like Pascal's 'with' operator
-- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
_______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://www.haskell.org/mailman/listinfo/haskell-prime

Hello Lennart, Tuesday, October 31, 2006, 1:16:43 AM, you wrote:
Funny that you should mention this idea. I spent last night and this morning implementing it in ghc. But I use '..' instead of '*'.
thank you a lot! it's sad that we not discussed this earlier :)
The punning is available both for expressions and patterns.
that you mean? thing mentioned by Iavor?: f Record1 {..} = let a = 1 b = 2 in Record2 {..}
I am of two minds about this extension. It introduces bound variables without mentioning the variable at the binding site. This can be error prone. (But 'import' has similar problems.)
Dubious as it is, when using large records it reduces the amount of boiler place code significantly.
exactly. and you name it - _boilerplate_ code. i can distinguish the things that is essential for understanding algorithm from things that just eats the space. and describing which options i'm going to use in this function is not the best job. ultimately, field selection operator will be enough, but it's beyound of our current abilities -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Nov 1, 2006, at 02:53 , Bulat Ziganshin wrote:
Hello Lennart,
The punning is available both for expressions and patterns.
that you mean? thing mentioned by Iavor?:
f Record1 {..} = let a = 1 b = 2 in Record2 {..}
Yes, exactly. I will send a patch for ghc as soon as I have cleaned it up and managed to test it some. (At the moment ghc HEAD cannot bootstrap itself on my MacBook so I can't test so well.) -- Lennart
participants (2)
-
Bulat Ziganshin
-
Lennart Augustsson