in reply to Re^3: Ordering of parameters - Re^9: Converting Unicode
in thread Converting Unicode

I do not care about your personal details, I was asking about your programming background, so that we'd know where you are coming from and what topics to use when trying to help you. Pascal is not really what I would have expected, but truth be told I've seen a (to my great surprise functional) program in pascal that started with a declaration of labels and variables and the it went from BEGIN to END. You are not a programmer by trade, OK, that's perfectly fine. What are you by trade? We do not want to know to belittle you, we want to know so that we can help. To be able to choose similes and examples that would make sense to you.

The solution is not Raku and as you convert more and more code you'll encounter the very same problems you are facing now. I can see use for a package sharing constants, but if you have a package for sharing global variables, you are doing it all wrong.

Maybe instead of trying to understand OOP, you ought to try using it. I don't mean using an OOP module made by someone else. I mean designing a tiny little module of your own. You'll likely go through several designs before things start to make sense, but that's to be expected. Back when I was starting with OOP I designed and redesigned and reredesigned a little text-mode menu and dialog library in Pascal and while I never used it in anything that anyone else would ever use, it was a great learning experience.

Perhaps you need to ignore all that inheritance and encapsulation talk and just start stuffing some data and subroutines changing that data into a separate package and eventually go from

my $results1 = doTheSearch(p1,p2,p3,p4,p5,p6,p7,...p55); my $results2 = doTheSearch(p1,p2,p3,otherp4,p5,differentp6,p7,...p55);
to
my $search = new Search(p1,p2,p3); $search->setLocalizationOptions(p21,p22,p23,p24); $search->enableThis(); $search->disableThat(); $search->setFulltextEngine('server', $username, $password); ... my $results1 = $search->searchFor(p4, p5, p6); my $results2 = $search->searchFor(otherp4, p5, differentp6);

In reality most classes never get subclassed and never import any traits or participate in any other OO stuff, so don't worry about those and don't worry that it all doesn't make sense. An object is not some esoteric concept, it's just a bunch of variables and methods. Something you can feed parameters to in chunks and have it keep the state. If you tend to call your search subroutine with 50+ parameters severa times and most parameters stay the same, then it should have been an object instead. And object that first receives (most of) the stuff that stays same and then each time gets called to do the work with just the stuff that changes passed at that particular place.

Jenda
1984 was supposed to be a warning,
not a manual!

Replies are listed 'Best First'.
Re^5: Ordering of parameters - Re^9: Converting Unicode (Polyglot's trade)
by eyepopslikeamosquito (Archbishop) on Dec 25, 2023 at 21:16 UTC

    What are you by trade? ... we want to know so that we can help. To be able to choose similes and examples that would make sense to you.

    Based on posts here, I'd go with teacher, with a keen interest in TEFL, especially Thai.

    Update: in this node he sounds like an English teacher. :) Moreover, Polyglot means "a person who knows and is able to use several languages".

    👁️🍾👍🦟
      Christian missionary. I just googled and found that out and it explains this entire thread.