Author Topic: problem with rem function  (Read 13571 times)

0 Members and 2 Guests are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: problem with rem function
« Reply #30 on: December 10, 2019, 03:47:51 PM »
Why would you keep original (rem) if you know it's buggy?

It's a matter of standard policy. Any programming, be it mine, my colleagues, my clients or third party software I may use should be able to rely on the standard functions as original platform supplied, regardless whether they meet my requirements or assessment of accuracy. Where deemed necessary alts can be penned and used, incorporating a naming convention that ensures original functions are preserved, e.g. a leading underscore as suggested in my example. Notwithstanding all said - what if the overriding programming proves flawed? Altogether just bad practice and a recipe for numerous, cascading problems difficult to trace to source.

... I and perhaps everyone else would suggest (strongly) that you should overwrite buggy (rem)...

Profoundly disagree and would recommend avoiding the works of any programmers that employ that strategy.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ribarm

  • Gator
  • Posts: 3263
  • Marko Ribar, architect
Re: problem with rem function
« Reply #31 on: December 10, 2019, 05:16:39 PM »
Really sad to hear that... This sounds to me like politician answer and not scientific... (rem) function is simple math and you should know that... Just to warn you : One mistake may lead to another one, and that to yet another, ... , and so on... If you don't want to update it's your business anyway, but don't accuse than someone else when and if something fails despite your program looks good and you want to implement it without any failure... Mistake was made by programming badly by you or someone else and if you want to avoid lacks in job, mistakes have to be treated as soon as possible by the time they were spot and reported... I for sure can't guarantee that my job is perfectly done and that I don't make mistakes, but I am behaving to be less stubborn person and I am trying to be flexible as much as possible in situations they occur to me... For sure my advantage is the fact that I am persistent in efforts to make things as much good and well as possible and that means that I treat mistakes they should be treated and I correct them in a workflow... I want that everyone is satisfied with consequences his/her duty brings and that job done by me or someone else should be satisfactory beneficial and as much as possible done without mistakes... This all tells me that I should trust rather something that is based on proofs and facts and not just arguments that defend and censor errors and bad practice made in past... To me things should always be better than they were no matter where and in what field of profession you look at... But that's just me, and yes I'll make changes to my life and profession especially when I see that something is wrong no matter there are arguments that it's not practical or profession ethical like you stated... Like no one can stop you not to react on the facts that something should be corrected, no one can stop me to correct thing I think that are wrong and this is the one case of such situation...

Stay well and be present in challenges they are to come yet and avoid to convince people in things you are unsure they are correct if you don't have arguments based on proofs that are already considered as natural universal facts and that are unnecessary to be tested for their validness...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: problem with rem function
« Reply #32 on: December 10, 2019, 05:56:57 PM »
This sounds to me like politician answer and not scientific ...

Thank you for your opinion.

Just to warn you : One mistake may lead to another one, and that to yet another, ... , and so on ...

Your arguments support my policy and recommendation.

I am persistent in efforts to make things as much good and well as possible and that means that I treat mistakes they should be treated and I correct them in a workflow...

You don't enjoy a monopoly on this work ethic. My record will have to speak for itself.

... froth  ...

Pass.

I've used rem in my programming hundreds, perhaps thousands of times in my decades of programming - with integers - not once with reals. If I ever require rem to process reals I'll opt to use a reliable _rem alternate, which is the correct way to deal with issues like this - in my opinion.

My recommendations stand.

Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Lee Mac

  • Seagull
  • Posts: 12912
  • London, England
Re: problem with rem function
« Reply #33 on: December 10, 2019, 05:58:43 PM »
Why would you keep original (rem) if you know it's buggy?

Any programming, be it mine, my colleagues, my clients or third party software I may use should be able to rely on the standard functions as original platform supplied, regardless whether they meet my requirements or assessment of accuracy.

I couldn't agree more with this sentiment. Locally redefining standard functions introduces yet another potential source of inconsistency when trying to debug behavioural differences in a program between two environments; when I use a standard function in a program, I would like to be confident in the knowledge that the definition of such function is consistent for all environments in which it is evaluated, bugs and all.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: problem with rem function
« Reply #34 on: December 10, 2019, 06:23:28 PM »
I couldn't agree more with this sentiment.

Thank you Lee.

Locally redefining standard functions introduces yet another potential source of inconsistency when trying to debug behavioral differences in a program between two environments; when I use a standard function in a program, I would like to be confident in the knowledge that the definition of such function is consistent for all environments in which it is evaluated, bugs and all.

Exactly.

Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: problem with rem function
« Reply #35 on: December 11, 2019, 12:20:51 PM »
Sorry I found the party late (someone gave me the wrong address; I suspect no foul play and still feel I am popular and funny).

Devil's-advocate-hat: what about: "(defun *error* (..."

Personal Opinion: I agree with some people---i.e. not prefer to redefine a built-in--because I feel it causes more concerns/work then just rolling my own version. -e.g. Debugging, sharing, mistakes etc.

If you override a built-in, there are essentially a few areas of major concern:
1. You should reset to the default behavior when you are done; other programs may rely on the default.
2. (common sense) Share/ship your override with every share (more critical then the use of a custom).
        a. if a custom function doesn't ship, the code will fail and the missing function will be obvious. 
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: problem with rem function
« Reply #36 on: December 11, 2019, 02:50:34 PM »
Devil's-advocate-hat: what about: "(defun *error* (..."
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7527
Re: problem with rem function
« Reply #37 on: December 11, 2019, 03:33:09 PM »
I'm no where near the coding expert as you MP .. but I totally agree that redefining built in functions with your own version is a bad idea. I know I could break all kinds of $h!+ :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: problem with rem function
« Reply #38 on: December 11, 2019, 03:39:29 PM »
Yay! Yet another time I opened the box and out jumped a whole bunch of snide.

Not that I've noticed a lot of this but what happens when a user-defined *error* is not localized or reset (and contains "custom/weird/turn-things-pink" code) and someone else uses that error. ...I was just trying to add to the conversation.

Code - Auto/Visual Lisp: [Select]
  1. ( (lambda ( / )
  2.     (princ "\nProgram 1")
  3.     (*error* "")) )
  4.  
  5. ( (lambda ( / )
  6.     (defun *error* (msg)
  7.       (command) (command)
  8.       (alert "Program 2 *error*"))
  9.     (princ "\nProgram 2")
  10.     (*error* "")) )
  11.  
  12. ( (lambda ( / )
  13.     (princ "\nProgram 3")
  14.     (exit)) )
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: problem with rem function
« Reply #39 on: December 11, 2019, 04:03:43 PM »
I'm no where near the coding expert as you MP .. but I totally agree that redefining built in functions with your own version is a bad idea. I know I could break all kinds of $h!+ :)

Thank you for posting the kind compliment and your take on the issue Ron.

Yay! Yet another time I opened the box and out jumped a whole bunch of snide.

John I'm not a mind reader. I anted up what I thought was an appropriate response. Breathe.

Cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10626
Re: problem with rem function
« Reply #40 on: December 12, 2019, 08:32:11 AM »
...
John I'm not a mind reader. I anted up what I thought was an appropriate response. Breathe.
...
1. You should reset to the default behavior when you are done; other programs may rely on the default.
Nor a post reader. You invested about 2 seconds before belittlement. Yes, I was restating the obvious/previous statements about an overridden function but I thought I'd give a place for people to address how they deal with--if at all (hence: "devils advocate")--the most overridden AutoLisp function in the tool box (*error*).

-i.e.
1. Do you trust that it's there--or functioning along the lines of "normal"--and use as normal?
2. Do you always include your own version?
3. Do you set to nil?
4. ...

Cannon fodder out
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: problem with rem function
« Reply #41 on: December 12, 2019, 09:08:04 AM »
John, you're mistaking brevity for snide.

I didn't think it warranted more than what I posted. But I'll indulge you.

It's a user defined function. Similar to a system variable, as a programmer I have to assume it will not exhibit the definition or state I require for my programming, so I will define it, or set it, according to my needs. Conscientious programmers restore the original environment on exit. That said, it does not enjoy the same repercussions as overriding a standard function but I'm not going to reiterate what's already been covered.

Have a great day, cheers.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst