bpr

First, congratulations! This is a really good release, I've been waiting for Nim concepts.

I tried thy example from the manual but the compiler complains about undeclared identifier vtref

They're not in the compiler sources at all. This section should be removed from the manual, or the feature added. I was looking forward to trying this out, in the hope that we'll see method deprecated if there's an easy to use alternative for dynamic dispatch.

2017-05-18 13:42:14

Congratulations!

Also bitops module (very useful) added.

2017-05-18 20:13:21

They're not in the compiler sources at all. This section should be removed from the manual, or the feature added. I was looking forward to trying this out, in the hope that we'll see method deprecated if there's an easy to use alternative for dynamic dispatch.

Yeah sorry about that, will update the manual. But you're spot on, I hope this feature means we can remove method from the language.

2017-05-18 20:56:18

Added to macro which allows JSON to be unmarshalled into a type.

This is a big deal for me. I do a lot of web backend work, and this macro will make my life so much easier. I've been playing around with Mongodb recently, and I can see this particular macro massively simplifying my code.

The try statement’s except branches now support the binding of a caught exception to a variable:

This is nice. try: except blocks now look exactly like Python! That's not a bad thing!

The .procvar annotation is not required anymore. That doesn’t mean you can pass system.$ to map just yet though.

This is something I was struggling with just recently. Glad to see it made it into the release.

Looks like a ton of bugs got fixed as well. Great job everyone who contributed!

2017-05-19 15:33:18
bpr

Yeah sorry about that, will update the manual.

Ahhh damn, I thought you'd go for the first option and add the feature soon

I'm really happy to read that method is on the chopping block. If it's any consolation, I think it was a bold and promising experiment, and even if it was a mistake in retrospect, it certainly seemed like a good idea at the time. I hope I don't say the same thing about vtref and vtptr later.

2017-05-19 18:41:57

Ahhh damn, I thought you'd go for the first option and add the feature soon

me too - normally documentation takes longer than implementation...

2017-05-20 09:21:49

First of all. Congratulations.

But you're spot on, I hope this feature means we can remove method from the language.

If you do, you may consider put some words into documentation what to do to achieve similar behaviour because there is quite a lot of people that are comfortable with that approach.

2017-05-20 11:17:22
bpr

If you do, you may consider put some words into documentation what to do to achieve similar behaviour because there is quite a lot of people that are comfortable with that approach.

Agreed on documentation. The VTable section of the manual is short, and there's no tutorial. IMO it would make more sense to rework the tutorial part 2 when the feature is ready.

It would be interesting to have some numbers on the use of method. Can you point to some Nim where the multiple dispatch feature is being used in an essential way? I wrote some 'expression problem' type code to test it but I rarely use dynamic dispatch at all in Nim. Are multimethods widely used, like they are in Julia? You can already simulate single dispatch already without using method.

2017-05-20 15:56:24

In Spry I use methods a lot, obviously, since Spry is dynamically typed. I think I use multimethods only a tad, for things like plus, minus etc to properly dispatch on combinations of integers and floats. But nothing that you couldn't solve using a bit of conditionals or double dispatch I guess.

Also, I would like for someone to explain what is so bad about methods and how vtable would be so much better - and that is an honest question since I have no idea.

2017-05-21 11:18:27
bpr

In Spry I use methods a lot, obviously, since Spry is dynamically typed.

Do you mean, you use them whilst coding in Spry, or while coding the Spry interpreter? Certainly in a Smalltalk like language, or in Java, you'll use methods a lot, as there aren't other options.

Also, I would like for someone to explain what is so bad about methods and how vtable would be so much better - and that is an honest question since I have no idea.

It's a great question, and I'd like to see more language design rationale questions like it on this forum. I'm tempted to start a new thread, but the forum software doesn't make that easy, so I'll continue here. If you want to make a discussion another thread may be better?

I don't think methods are 'bad', by 'methods' here, I mean the (implicit) dynamic dispatch/open recursion that makes a language OO. I don't even think that multimethods/multidispatch are bad. My view, not necessarily shared, is that Nim is a language favoring static/compile time techniques, and that there's some kind of inherent tension with baking higher level dynamic capabilities into the language, in particular, multimethods, which impose costs on the rest of the design. I'd prefer minimalism for the OO part of the language; single dispatch and maybe Go-like interfaces. That's a design space already well explored in statically typed, imperative languages.

2017-05-21 19:15:06