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

Lennart Augustsson lennart at augustsson.net
Tue Oct 31 18:00:18 EST 2006


If we allow C{..} in patterns we should absolutely have it in  
expressions too.  Both for symmetry and usefulness.

	-- Lennart

On Oct 31, 2006, at 14:06 , Iavor Diatchki wrote:

> Hello,
> I think the "it may be confusing to novices" argument tends to be
> over-used and we should be careful before we make language decisions
> solely based on it.  At the  very least, when there is a suggestion
> that something might be confusing to someone, there should be an
> explanation of what/why/to whom it is confusing.
>
> I think record puns are a nice feature, it is easy to explain, and
> without them the Haskell record system is less useful, at least to me.
>
> By the way, if I recall correctly, in Johan Nordlander's O'Hugs the ..
> notation (called record packing, I think) could also be used to create
> record values.  I think it worked like this:
>> data Point = Point { x,y :: Int }
>> pt = let { x = 3; y = 4 } in Point { .. }
>
> The ".." is expanded to "{x = x, y = y}" based on the fields for the
> particular constructor.  It seems that if we have the "Point { .. }"
> pattern, we should also have the constructor version.  What do people
> think?
>
> -Iavor
>
>
>
>
> On 10/31/06, Seth Kurtzberg <seth at cql.com> wrote:
>> On Tue, 31 Oct 2006 13:59:45 +0300
>> Bulat Ziganshin <bulat.ziganshin at gmail.com> wrote:
>>
>> > Hello Neil,
>> >
>> > Tuesday, October 31, 2006, 4:04:23 AM, you wrote:
>> >
>> > >> > puns like Foo { .. } would be great too.
>> > >>
>> > >> I'd vote for enabling them with a command line switch, rather  
>> than by default, as they can be confusing to folks learning the  
>> language.
>> >
>> > > How discussions come full circle :) I started this discussion  
>> on the
>> > > Hugs users list because I want to _remove_ the command line  
>> switch for
>> > > puns from Yhc. I'm not overly fussed whether I remove the entire
>> > > feature, or just remove the command line and make it always on by
>> > > default, but I do want the command line switch gone!
>> >
>> > compiler switch can't be made a part of Haskell' :)
>> >
>> > and anyway, i don't see how cmdline switch may help noivices - when
>> > they use ".." by mistake and program mysteriously not fails? or  
>> when
>> > they stare at the other's program and understand that this unknown
>> > ".." work only because this program compiled with some special  
>> switch?
>>
>> I wasn't talking about the .., I was talking about the primary  
>> issue raised by the email, which has nothing to do with ..
>>
>> Instead of assuming that I was saying something totally useless  
>> and worthless, it might not be a bad idea to respond to _my_  
>> email, not an email which contains a quote of one line from my email.
>>
>> >
>> > and yes, record puns seems very ggod candidate for H'. it's widely
>> > used (i used it until switched to GHC), it was already in  
>> Haskell, and
>> > now it is impelemnted by every compiler
>> >
>> > wildcard puns is more discussible, but i personally need this  
>> feature
>> >
>> >
>> > --
>> > Best regards,
>> >  Bulat                            mailto:Bulat.Ziganshin at gmail.com
>> >
>> >
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list