vtkNew in examples (or auto?)

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

vtkNew in examples (or auto?)

Elvis Stansvik
Hi all,

How about a refactor of the examples to use vtkNew instead of
vtkSmartPointer (where it makes sense)?

E.g.

  vtkNew<vtkActor> actor;
  actor->SetMapper(mapper);

  vtkNew<vtkRenderer> renderer;
  renderer->AddActor(actor);

instead of

  vtkSmartPointer<vtkActor> actor =
    vtkSmartPointer<vtkActor>::New();
  actor->SetMapper(mapper);

  vtkSmartPointer<vtkRenderer> renderer =
    vtkSmartPointer<vtkRenderer>::New();
  renderer->AddActor(actor);

I think it would help with the readability of the examples. Or are
there other reasons for the prevalent use of vtkSmartPointer?

Another option would be to use auto, e.g.

  auto actor = vtkSmartPointer<vtkActor>::New();

Also, would anyone mind if I did a little naming cleanup, mostly
things like "renwin" -> "window" and "iren" -> "interactor"? Those
abbreviations are not that bad, but I think it's better in examples to
spell out the variables in proper English.

If there are no objections, I could try to prepare an MR when time
permits. If so, vtkNew, or auto?

Elvis
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Elvis Stansvik
2017-06-22 18:57 GMT+02:00 Elvis Stansvik <[hidden email]>:

> Hi all,
>
> How about a refactor of the examples to use vtkNew instead of
> vtkSmartPointer (where it makes sense)?
>
> E.g.
>
>   vtkNew<vtkActor> actor;
>   actor->SetMapper(mapper);
>
>   vtkNew<vtkRenderer> renderer;
>   renderer->AddActor(actor);

Well, missing some .Get() here, but you see what I mean.

Elvis

>
> instead of
>
>   vtkSmartPointer<vtkActor> actor =
>     vtkSmartPointer<vtkActor>::New();
>   actor->SetMapper(mapper);
>
>   vtkSmartPointer<vtkRenderer> renderer =
>     vtkSmartPointer<vtkRenderer>::New();
>   renderer->AddActor(actor);
>
> I think it would help with the readability of the examples. Or are
> there other reasons for the prevalent use of vtkSmartPointer?
>
> Another option would be to use auto, e.g.
>
>   auto actor = vtkSmartPointer<vtkActor>::New();
>
> Also, would anyone mind if I did a little naming cleanup, mostly
> things like "renwin" -> "window" and "iren" -> "interactor"? Those
> abbreviations are not that bad, but I think it's better in examples to
> spell out the variables in proper English.
>
> If there are no objections, I could try to prepare an MR when time
> permits. If so, vtkNew, or auto?
>
> Elvis
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Bill Lorensen
In reply to this post by Elvis Stansvik
I prefer vtkSmartPointer because it can be used like any other vtk
pointer. No need for a GetPointer() is some cases. The example writer
is free to use vtkSmartPointer or vtkNew. But I would leave them as
there are.


Other cleanup's sound great. I've also started using vtkNamedColors
instead of setting float values.

On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik
<[hidden email]> wrote:

> Hi all,
>
> How about a refactor of the examples to use vtkNew instead of
> vtkSmartPointer (where it makes sense)?
>
> E.g.
>
>   vtkNew<vtkActor> actor;
>   actor->SetMapper(mapper);
>
>   vtkNew<vtkRenderer> renderer;
>   renderer->AddActor(actor);
>
> instead of
>
>   vtkSmartPointer<vtkActor> actor =
>     vtkSmartPointer<vtkActor>::New();
>   actor->SetMapper(mapper);
>
>   vtkSmartPointer<vtkRenderer> renderer =
>     vtkSmartPointer<vtkRenderer>::New();
>   renderer->AddActor(actor);
>
> I think it would help with the readability of the examples. Or are
> there other reasons for the prevalent use of vtkSmartPointer?
>
> Another option would be to use auto, e.g.
>
>   auto actor = vtkSmartPointer<vtkActor>::New();
>
> Also, would anyone mind if I did a little naming cleanup, mostly
> things like "renwin" -> "window" and "iren" -> "interactor"? Those
> abbreviations are not that bad, but I think it's better in examples to
> spell out the variables in proper English.
>
> If there are no objections, I could try to prepare an MR when time
> permits. If so, vtkNew, or auto?
>
> Elvis
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Elvis Stansvik
2017-06-22 19:01 GMT+02:00 Bill Lorensen <[hidden email]>:
> I prefer vtkSmartPointer because it can be used like any other vtk
> pointer. No need for a GetPointer() is some cases. The example writer
> is free to use vtkSmartPointer or vtkNew. But I would leave them as
> there are.

Right, that's a valid point. But how about auto-fying the
declarations? (but keep using vtkSmartPointer)

My motivation is that when reading an example, I'm often squinting to
find the variable names in the declarations, wedged in there somewhere
between all those type names and angle brackets. Especially as the
lines are often broken due to running long.

>
>
> Other cleanup's sound great. I've also started using vtkNamedColors
> instead of setting float values.

Great.

Elvis

>
> On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik
> <[hidden email]> wrote:
>> Hi all,
>>
>> How about a refactor of the examples to use vtkNew instead of
>> vtkSmartPointer (where it makes sense)?
>>
>> E.g.
>>
>>   vtkNew<vtkActor> actor;
>>   actor->SetMapper(mapper);
>>
>>   vtkNew<vtkRenderer> renderer;
>>   renderer->AddActor(actor);
>>
>> instead of
>>
>>   vtkSmartPointer<vtkActor> actor =
>>     vtkSmartPointer<vtkActor>::New();
>>   actor->SetMapper(mapper);
>>
>>   vtkSmartPointer<vtkRenderer> renderer =
>>     vtkSmartPointer<vtkRenderer>::New();
>>   renderer->AddActor(actor);
>>
>> I think it would help with the readability of the examples. Or are
>> there other reasons for the prevalent use of vtkSmartPointer?
>>
>> Another option would be to use auto, e.g.
>>
>>   auto actor = vtkSmartPointer<vtkActor>::New();
>>
>> Also, would anyone mind if I did a little naming cleanup, mostly
>> things like "renwin" -> "window" and "iren" -> "interactor"? Those
>> abbreviations are not that bad, but I think it's better in examples to
>> spell out the variables in proper English.
>>
>> If there are no objections, I could try to prepare an MR when time
>> permits. If so, vtkNew, or auto?
>>
>> Elvis
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Bill Lorensen
I'm not sure what you mean by auto-fying



On Thu, Jun 22, 2017 at 1:07 PM, Elvis Stansvik
<[hidden email]> wrote:

> 2017-06-22 19:01 GMT+02:00 Bill Lorensen <[hidden email]>:
>> I prefer vtkSmartPointer because it can be used like any other vtk
>> pointer. No need for a GetPointer() is some cases. The example writer
>> is free to use vtkSmartPointer or vtkNew. But I would leave them as
>> there are.
>
> Right, that's a valid point. But how about auto-fying the
> declarations? (but keep using vtkSmartPointer)
>
> My motivation is that when reading an example, I'm often squinting to
> find the variable names in the declarations, wedged in there somewhere
> between all those type names and angle brackets. Especially as the
> lines are often broken due to running long.
>
>>
>>
>> Other cleanup's sound great. I've also started using vtkNamedColors
>> instead of setting float values.
>
> Great.
>
> Elvis
>
>>
>> On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik
>> <[hidden email]> wrote:
>>> Hi all,
>>>
>>> How about a refactor of the examples to use vtkNew instead of
>>> vtkSmartPointer (where it makes sense)?
>>>
>>> E.g.
>>>
>>>   vtkNew<vtkActor> actor;
>>>   actor->SetMapper(mapper);
>>>
>>>   vtkNew<vtkRenderer> renderer;
>>>   renderer->AddActor(actor);
>>>
>>> instead of
>>>
>>>   vtkSmartPointer<vtkActor> actor =
>>>     vtkSmartPointer<vtkActor>::New();
>>>   actor->SetMapper(mapper);
>>>
>>>   vtkSmartPointer<vtkRenderer> renderer =
>>>     vtkSmartPointer<vtkRenderer>::New();
>>>   renderer->AddActor(actor);
>>>
>>> I think it would help with the readability of the examples. Or are
>>> there other reasons for the prevalent use of vtkSmartPointer?
>>>
>>> Another option would be to use auto, e.g.
>>>
>>>   auto actor = vtkSmartPointer<vtkActor>::New();
>>>
>>> Also, would anyone mind if I did a little naming cleanup, mostly
>>> things like "renwin" -> "window" and "iren" -> "interactor"? Those
>>> abbreviations are not that bad, but I think it's better in examples to
>>> spell out the variables in proper English.
>>>
>>> If there are no objections, I could try to prepare an MR when time
>>> permits. If so, vtkNew, or auto?
>>>
>>> Elvis
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Elvis Stansvik
2017-06-22 19:09 GMT+02:00 Bill Lorensen <[hidden email]>:
> I'm not sure what you mean by auto-fying

Sorry, I should have been clearer. What I mean is changing declarations such as

  vtkSmartPointer<vtkActor> actor =
    vtkSmartPointer<vtkActor>::New();

into

  auto actor = vtkSmartPointer<vtkActor>::New();

I think it would cut down on the number of lines in many examples, and
make them more readable. (This would only be done in places where the
type of the variable is still clear from the declaration.)

Elvis

>
>
>
> On Thu, Jun 22, 2017 at 1:07 PM, Elvis Stansvik
> <[hidden email]> wrote:
>> 2017-06-22 19:01 GMT+02:00 Bill Lorensen <[hidden email]>:
>>> I prefer vtkSmartPointer because it can be used like any other vtk
>>> pointer. No need for a GetPointer() is some cases. The example writer
>>> is free to use vtkSmartPointer or vtkNew. But I would leave them as
>>> there are.
>>
>> Right, that's a valid point. But how about auto-fying the
>> declarations? (but keep using vtkSmartPointer)
>>
>> My motivation is that when reading an example, I'm often squinting to
>> find the variable names in the declarations, wedged in there somewhere
>> between all those type names and angle brackets. Especially as the
>> lines are often broken due to running long.
>>
>>>
>>>
>>> Other cleanup's sound great. I've also started using vtkNamedColors
>>> instead of setting float values.
>>
>> Great.
>>
>> Elvis
>>
>>>
>>> On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik
>>> <[hidden email]> wrote:
>>>> Hi all,
>>>>
>>>> How about a refactor of the examples to use vtkNew instead of
>>>> vtkSmartPointer (where it makes sense)?
>>>>
>>>> E.g.
>>>>
>>>>   vtkNew<vtkActor> actor;
>>>>   actor->SetMapper(mapper);
>>>>
>>>>   vtkNew<vtkRenderer> renderer;
>>>>   renderer->AddActor(actor);
>>>>
>>>> instead of
>>>>
>>>>   vtkSmartPointer<vtkActor> actor =
>>>>     vtkSmartPointer<vtkActor>::New();
>>>>   actor->SetMapper(mapper);
>>>>
>>>>   vtkSmartPointer<vtkRenderer> renderer =
>>>>     vtkSmartPointer<vtkRenderer>::New();
>>>>   renderer->AddActor(actor);
>>>>
>>>> I think it would help with the readability of the examples. Or are
>>>> there other reasons for the prevalent use of vtkSmartPointer?
>>>>
>>>> Another option would be to use auto, e.g.
>>>>
>>>>   auto actor = vtkSmartPointer<vtkActor>::New();
>>>>
>>>> Also, would anyone mind if I did a little naming cleanup, mostly
>>>> things like "renwin" -> "window" and "iren" -> "interactor"? Those
>>>> abbreviations are not that bad, but I think it's better in examples to
>>>> spell out the variables in proper English.
>>>>
>>>> If there are no objections, I could try to prepare an MR when time
>>>> permits. If so, vtkNew, or auto?
>>>>
>>>> Elvis
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>>
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Bill Lorensen
Let's leave them as is for now. I want to make sure I understand this.


On Thu, Jun 22, 2017 at 1:13 PM, Elvis Stansvik
<[hidden email]> wrote:

> 2017-06-22 19:09 GMT+02:00 Bill Lorensen <[hidden email]>:
>> I'm not sure what you mean by auto-fying
>
> Sorry, I should have been clearer. What I mean is changing declarations such as
>
>   vtkSmartPointer<vtkActor> actor =
>     vtkSmartPointer<vtkActor>::New();
>
> into
>
>   auto actor = vtkSmartPointer<vtkActor>::New();
>
> I think it would cut down on the number of lines in many examples, and
> make them more readable. (This would only be done in places where the
> type of the variable is still clear from the declaration.)
>
> Elvis
>
>>
>>
>>
>> On Thu, Jun 22, 2017 at 1:07 PM, Elvis Stansvik
>> <[hidden email]> wrote:
>>> 2017-06-22 19:01 GMT+02:00 Bill Lorensen <[hidden email]>:
>>>> I prefer vtkSmartPointer because it can be used like any other vtk
>>>> pointer. No need for a GetPointer() is some cases. The example writer
>>>> is free to use vtkSmartPointer or vtkNew. But I would leave them as
>>>> there are.
>>>
>>> Right, that's a valid point. But how about auto-fying the
>>> declarations? (but keep using vtkSmartPointer)
>>>
>>> My motivation is that when reading an example, I'm often squinting to
>>> find the variable names in the declarations, wedged in there somewhere
>>> between all those type names and angle brackets. Especially as the
>>> lines are often broken due to running long.
>>>
>>>>
>>>>
>>>> Other cleanup's sound great. I've also started using vtkNamedColors
>>>> instead of setting float values.
>>>
>>> Great.
>>>
>>> Elvis
>>>
>>>>
>>>> On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik
>>>> <[hidden email]> wrote:
>>>>> Hi all,
>>>>>
>>>>> How about a refactor of the examples to use vtkNew instead of
>>>>> vtkSmartPointer (where it makes sense)?
>>>>>
>>>>> E.g.
>>>>>
>>>>>   vtkNew<vtkActor> actor;
>>>>>   actor->SetMapper(mapper);
>>>>>
>>>>>   vtkNew<vtkRenderer> renderer;
>>>>>   renderer->AddActor(actor);
>>>>>
>>>>> instead of
>>>>>
>>>>>   vtkSmartPointer<vtkActor> actor =
>>>>>     vtkSmartPointer<vtkActor>::New();
>>>>>   actor->SetMapper(mapper);
>>>>>
>>>>>   vtkSmartPointer<vtkRenderer> renderer =
>>>>>     vtkSmartPointer<vtkRenderer>::New();
>>>>>   renderer->AddActor(actor);
>>>>>
>>>>> I think it would help with the readability of the examples. Or are
>>>>> there other reasons for the prevalent use of vtkSmartPointer?
>>>>>
>>>>> Another option would be to use auto, e.g.
>>>>>
>>>>>   auto actor = vtkSmartPointer<vtkActor>::New();
>>>>>
>>>>> Also, would anyone mind if I did a little naming cleanup, mostly
>>>>> things like "renwin" -> "window" and "iren" -> "interactor"? Those
>>>>> abbreviations are not that bad, but I think it's better in examples to
>>>>> spell out the variables in proper English.
>>>>>
>>>>> If there are no objections, I could try to prepare an MR when time
>>>>> permits. If so, vtkNew, or auto?
>>>>>
>>>>> Elvis
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>>
>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>
>>>>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>>>>
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Unpaid intern in BillsBasement at noware dot com
>>
>>
>>
>> --
>> Unpaid intern in BillsBasement at noware dot com



--
Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Elvis Stansvik
2017-06-22 19:32 GMT+02:00 Bill Lorensen <[hidden email]>:
> Let's leave them as is for now. I want to make sure I understand this.

Alright, fair enough, it's not a big gripe. Just let me know if you
change your mind in the future and I can do the work.

Elvis

>
>
> On Thu, Jun 22, 2017 at 1:13 PM, Elvis Stansvik
> <[hidden email]> wrote:
>> 2017-06-22 19:09 GMT+02:00 Bill Lorensen <[hidden email]>:
>>> I'm not sure what you mean by auto-fying
>>
>> Sorry, I should have been clearer. What I mean is changing declarations such as
>>
>>   vtkSmartPointer<vtkActor> actor =
>>     vtkSmartPointer<vtkActor>::New();
>>
>> into
>>
>>   auto actor = vtkSmartPointer<vtkActor>::New();
>>
>> I think it would cut down on the number of lines in many examples, and
>> make them more readable. (This would only be done in places where the
>> type of the variable is still clear from the declaration.)
>>
>> Elvis
>>
>>>
>>>
>>>
>>> On Thu, Jun 22, 2017 at 1:07 PM, Elvis Stansvik
>>> <[hidden email]> wrote:
>>>> 2017-06-22 19:01 GMT+02:00 Bill Lorensen <[hidden email]>:
>>>>> I prefer vtkSmartPointer because it can be used like any other vtk
>>>>> pointer. No need for a GetPointer() is some cases. The example writer
>>>>> is free to use vtkSmartPointer or vtkNew. But I would leave them as
>>>>> there are.
>>>>
>>>> Right, that's a valid point. But how about auto-fying the
>>>> declarations? (but keep using vtkSmartPointer)
>>>>
>>>> My motivation is that when reading an example, I'm often squinting to
>>>> find the variable names in the declarations, wedged in there somewhere
>>>> between all those type names and angle brackets. Especially as the
>>>> lines are often broken due to running long.
>>>>
>>>>>
>>>>>
>>>>> Other cleanup's sound great. I've also started using vtkNamedColors
>>>>> instead of setting float values.
>>>>
>>>> Great.
>>>>
>>>> Elvis
>>>>
>>>>>
>>>>> On Thu, Jun 22, 2017 at 12:57 PM, Elvis Stansvik
>>>>> <[hidden email]> wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> How about a refactor of the examples to use vtkNew instead of
>>>>>> vtkSmartPointer (where it makes sense)?
>>>>>>
>>>>>> E.g.
>>>>>>
>>>>>>   vtkNew<vtkActor> actor;
>>>>>>   actor->SetMapper(mapper);
>>>>>>
>>>>>>   vtkNew<vtkRenderer> renderer;
>>>>>>   renderer->AddActor(actor);
>>>>>>
>>>>>> instead of
>>>>>>
>>>>>>   vtkSmartPointer<vtkActor> actor =
>>>>>>     vtkSmartPointer<vtkActor>::New();
>>>>>>   actor->SetMapper(mapper);
>>>>>>
>>>>>>   vtkSmartPointer<vtkRenderer> renderer =
>>>>>>     vtkSmartPointer<vtkRenderer>::New();
>>>>>>   renderer->AddActor(actor);
>>>>>>
>>>>>> I think it would help with the readability of the examples. Or are
>>>>>> there other reasons for the prevalent use of vtkSmartPointer?
>>>>>>
>>>>>> Another option would be to use auto, e.g.
>>>>>>
>>>>>>   auto actor = vtkSmartPointer<vtkActor>::New();
>>>>>>
>>>>>> Also, would anyone mind if I did a little naming cleanup, mostly
>>>>>> things like "renwin" -> "window" and "iren" -> "interactor"? Those
>>>>>> abbreviations are not that bad, but I think it's better in examples to
>>>>>> spell out the variables in proper English.
>>>>>>
>>>>>> If there are no objections, I could try to prepare an MR when time
>>>>>> permits. If so, vtkNew, or auto?
>>>>>>
>>>>>> Elvis
>>>>>> _______________________________________________
>>>>>> Powered by www.kitware.com
>>>>>>
>>>>>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>>
>>>>>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>>>>>
>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>> http://public.kitware.com/mailman/listinfo/vtk-developers
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Unpaid intern in BillsBasement at noware dot com
>>>
>>>
>>>
>>> --
>>> Unpaid intern in BillsBasement at noware dot com
>
>
>
> --
> Unpaid intern in BillsBasement at noware dot com
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Marcus D. Hanwell-2
In reply to this post by Bill Lorensen
On Thu, Jun 22, 2017 at 1:01 PM, Bill Lorensen <[hidden email]> wrote:
>
> I prefer vtkSmartPointer because it can be used like any other vtk
> pointer. No need for a GetPointer() is some cases. The example writer
> is free to use vtkSmartPointer or vtkNew. But I would leave them as
> there are.
>
If that is detracting from using vtkNew then I think we should add the
single line to vtkNew. This has bothered me for a while, and I think
it is fair to make vtkNew behave more like the other two pointer
classes. I liked the explicitness of calling Get(), but think it makes
what would otherwise be more convenient a little harder to use.

I will see about putting in a patch for this soon. I really would
rather get rid of the duplication in the examples by preferring vtkNew
or using auto. It is harder to read, and needlessly repeats the class
name in my opinion.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Brad King
On 06/26/2017 01:06 PM, Marcus D. Hanwell wrote:
> If that is detracting from using vtkNew then I think we should add the
> single line to vtkNew.
>
> I will see about putting in a patch for this soon. I really would
> rather get rid of the duplication in the examples by preferring vtkNew
> or using auto. It is harder to read, and needlessly repeats the class
> name in my opinion.

FYI: https://gitlab.kitware.com/vtk/vtk/merge_requests/2961

-Brad

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Marcus D. Hanwell-2
On Mon, Jun 26, 2017 at 2:07 PM, Brad King <[hidden email]> wrote:

> On 06/26/2017 01:06 PM, Marcus D. Hanwell wrote:
>> If that is detracting from using vtkNew then I think we should add the
>> single line to vtkNew.
>>
>> I will see about putting in a patch for this soon. I really would
>> rather get rid of the duplication in the examples by preferring vtkNew
>> or using auto. It is harder to read, and needlessly repeats the class
>> name in my opinion.
>
> FYI: https://gitlab.kitware.com/vtk/vtk/merge_requests/2961
>
Thanks Brad, Bill pointed it out to me and I commented. I think it is
time to make the vtkNew interface more consistent, and I regret my
youthful desire for purity in the face of inconsistency :-)
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

VTK - Dev mailing list
I hereby retract my "disastrous" comment from the other email thread
on this topic...

On Mon, Jun 26, 2017 at 3:07 PM, Marcus D. Hanwell
<[hidden email]> wrote:

> On Mon, Jun 26, 2017 at 2:07 PM, Brad King <[hidden email]> wrote:
>> On 06/26/2017 01:06 PM, Marcus D. Hanwell wrote:
>>> If that is detracting from using vtkNew then I think we should add the
>>> single line to vtkNew.
>>>
>>> I will see about putting in a patch for this soon. I really would
>>> rather get rid of the duplication in the examples by preferring vtkNew
>>> or using auto. It is harder to read, and needlessly repeats the class
>>> name in my opinion.
>>
>> FYI: https://gitlab.kitware.com/vtk/vtk/merge_requests/2961
>>
> Thanks Brad, Bill pointed it out to me and I commented. I think it is
> time to make the vtkNew interface more consistent, and I regret my
> youthful desire for purity in the face of inconsistency :-)
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Marcus D. Hanwell-2
On Mon, Jun 26, 2017 at 3:30 PM, David Cole <[hidden email]> wrote:
> I hereby retract my "disastrous" comment from the other email thread
> on this topic...
>
That was quite a thread, it was hidden by a terrible subject that gave
me no idea what it was about. I think I was with you, but as vtkObject
derived classes are all reference counted, and vtkSmartPointer/vtkNew
are effectively the same as far as risk of going out of
scope/returning a dangling pointer we should be consistent.

I am not a fan of either implicitly converting, but if one does it
they both should. I was just being cautious at the time, but I think
it was the wrong call, and would prefer consistency. I routinely use
vtkSmartPointer and vtkNew in class design to take care of objects,
and when switching between the two it is a pain because of the
inconsistency.

I had been planning to propose this patch for a while, and am glad
someone else did. It is a simple change, but it makes using the two
far more interchangeable, and will hopefully encourage more people to
use our pointer classes to aid with memory management, and banish the
smart pointer creation macros littering tests.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Andras Lasso
Thanks for all the comments on this topic. I've updated the pull request (squashed commits, included main points from the discussions):

https://gitlab.kitware.com/lassoan/vtk/commit/00bf5f3d3acf655e396feb4d3b7167806aba05b9

Andras

-----Original Message-----
From: vtk-developers [mailto:[hidden email]] On Behalf Of Marcus D. Hanwell
Sent: Monday, June 26, 2017 9:47 PM
To: David Cole <[hidden email]>
Cc: VTK Developers <[hidden email]>; Brad King <[hidden email]>
Subject: Re: [vtk-developers] vtkNew in examples (or auto?)

On Mon, Jun 26, 2017 at 3:30 PM, David Cole <[hidden email]> wrote:
> I hereby retract my "disastrous" comment from the other email thread
> on this topic...
>
That was quite a thread, it was hidden by a terrible subject that gave me no idea what it was about. I think I was with you, but as vtkObject derived classes are all reference counted, and vtkSmartPointer/vtkNew are effectively the same as far as risk of going out of scope/returning a dangling pointer we should be consistent.

I am not a fan of either implicitly converting, but if one does it they both should. I was just being cautious at the time, but I think it was the wrong call, and would prefer consistency. I routinely use vtkSmartPointer and vtkNew in class design to take care of objects, and when switching between the two it is a pain because of the inconsistency.

I had been planning to propose this patch for a while, and am glad someone else did. It is a simple change, but it makes using the two far more interchangeable, and will hopefully encourage more people to use our pointer classes to aid with memory management, and banish the smart pointer creation macros littering tests.
_______________________________________________
Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=8qrELn4ovJgQN7AjOI8E3FDzrU%2FudajhRDLyeUpCoYg%3D&reserved=0

Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=j%2BaQLKquqzpFouD%2BxG0Mu%2FK7vDiyhWkVy2AcH2y8whE%3D&reserved=0

Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=6XZzGlIeDboJvRDMokX422KvtmCrIltQtXD4vRE20bY%3D&reserved=0

Follow this link to subscribe/unsubscribe:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=3Mffbxh0OuhI%2FEd83nrkhyOelfKcmG1pq99WstkE1Vw%3D&reserved=0

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: vtkNew in examples (or auto?)

Elvis Stansvik

Den 27 juni 2017 1:34 fm skrev "Andras Lasso" <[hidden email]>:
>
> Thanks for all the comments on this topic. I've updated the pull request (squashed commits, included main points from the discussions):

Thanks a lot for taking care of this.

Now, my original post was about the examples. Those will naturally not be updated to take care of this brand new functionality, since they need to work with older VTKs.

However, regarding the auto keyword for declarations (but keeping the use of vtkSmartPointer intact): The objection to that was older compilers, but auto has been supported in all major compilers since 2010.

I'd like to get some more opinions on this. Personally I think compilers lacking auto is so rare that the improved readability of the examples outweigh the inconvenience of those who use old compilers (who will have to adapt the examples).

Should we have a poll on this, like was done for vtkNew implicit conversion?

Elvis

>
> https://gitlab.kitware.com/lassoan/vtk/commit/00bf5f3d3acf655e396feb4d3b7167806aba05b9
>
> Andras
>
> -----Original Message-----
> From: vtk-developers [mailto:[hidden email]] On Behalf Of Marcus D. Hanwell
> Sent: Monday, June 26, 2017 9:47 PM
> To: David Cole <[hidden email]>
> Cc: VTK Developers <[hidden email]>; Brad King <[hidden email]>
> Subject: Re: [vtk-developers] vtkNew in examples (or auto?)
>
> On Mon, Jun 26, 2017 at 3:30 PM, David Cole <[hidden email]> wrote:
> > I hereby retract my "disastrous" comment from the other email thread
> > on this topic...
> >
> That was quite a thread, it was hidden by a terrible subject that gave me no idea what it was about. I think I was with you, but as vtkObject derived classes are all reference counted, and vtkSmartPointer/vtkNew are effectively the same as far as risk of going out of scope/returning a dangling pointer we should be consistent.
>
> I am not a fan of either implicitly converting, but if one does it they both should. I was just being cautious at the time, but I think it was the wrong call, and would prefer consistency. I routinely use vtkSmartPointer and vtkNew in class design to take care of objects, and when switching between the two it is a pain because of the inconsistency.
>
> I had been planning to propose this patch for a while, and am glad someone else did. It is a simple change, but it makes using the two far more interchangeable, and will hopefully encourage more people to use our pointer classes to aid with memory management, and banish the smart pointer creation macros littering tests.
> _______________________________________________
> Powered by https://na01.safelinks.protection.outlook.com/?url=www.kitware.com&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=8qrELn4ovJgQN7AjOI8E3FDzrU%2FudajhRDLyeUpCoYg%3D&reserved=0
>
> Visit other Kitware open-source projects at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=j%2BaQLKquqzpFouD%2BxG0Mu%2FK7vDiyhWkVy2AcH2y8whE%3D&reserved=0
>
> Search the list archives at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=6XZzGlIeDboJvRDMokX422KvtmCrIltQtXD4vRE20bY%3D&reserved=0
>
> Follow this link to subscribe/unsubscribe:
> https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C02ba850c4d54497c377408d4bccc2f2f%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636341032526560231&sdata=3Mffbxh0OuhI%2FEd83nrkhyOelfKcmG1pq99WstkE1Vw%3D&reserved=0
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>


_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Search the list archives at: http://markmail.org/search/?q=vtk-developers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtk-developers

Loading...