|
Perhaps a dialog's returning a custom data class wasn't the best argument. I think I have a better argument for an embedded class, anyway. I'm working on a class that programmatically displays rectangles of specific color samples, and the user is expected to click on the particular rectangle to select a color. OK, nothing special about that. I am displaying the colors in a matrix of rectangles that are programmatically generated panels, given a generic List of colors that I want to present. After I got deep into the coding, I decided I wanted to have a border around every rectangle, where the color of the border signified which palette the color was in. Not that there are expected to be a lot of palettes, maybe 1, 2 or 3. But I ran into a problem: the panel control doesn't have a means to define the color of it's border. I posed that problem to ChatGPT, and it suggested I write a custom Panel class that extends the standard panel class and showed me how I could override paint to put a border of any specified color around the Panels I am creating. I don't plan to use this custom panel class anywhere else, it is short and to the point, and there seems no reason yet for having it in a stand-alone file.
Steve
|
|
|
|
|
okay, I can see that a private class that is used in that one location. what I'm fighting with is that everything is public.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
I always try to use the right tool for the right job.
|
|
|
|
|
I agree, but what I am seeing is a coding style vs a design approach.
Charlie Gilley
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
Has never been more appropriate.
|
|
|
|
|
Actually, I often do. A classic example is defining an Iterator class for a container type. It makes more sense to have the Iterator class definition be part of the container class definition (and hence called MyVector::Iterator, for example, than to create a separate MyVectorIterator, and typedef the Iterator type in MyVector.
Another example is a Pimpl pattern, although in this case the embedded class is just a declaration on the public interface, and the actual definition is in the implementation file.
|
|
|
|
|
Only if there is a specific reason to do so.
One use case is that there are a lot of friends of the main class but I want tighter control over users of the embedded class.
|
|
|
|
|
Statement 1: Every rule has an exception.
Statement 2: Statement 1 is a rule. Therefore Statement 1 has an exception.
Conclusion: There is at least one rule which has no exception.
Would you agree with this conclusion? If so, is there any example of a rule having no exception?
|
|
|
|
|
Friends don't let friends program in Basic.
If you can't find time to do it right the first time, how are you going to find time to do it again?
PartsBin an Electronics Part Organizer - Release Version 1.4.0 (Many new features) JaxCoder.com
Latest Article: EventAggregator
|
|
|
|
|
Kurt Gödel proved a version of Statement 1:
In any formal language, there are questions that can be asked but not answered.
A perfect example of Gödel's incompleteness law can be found in math:
- Positive Integers (lengths) can subtract a larger number from a smaller number. The answer is a negative integer, leading to:
- All integers can divide and result in a fraction, leading to:
- Fractions can be used in geometry to result in real numbers, leading to:
- Real Numbers can have square roots that are imaginary, leading to:
- Complex numbers, etc...
|
|
|
|
|
I always think of Godel’s Completeness/Incompleteness theorems when people invent new encoding systems, etc.
XML : How do I encode “<“?
<
Well how do I encode ampersand?
&
etc.
CSV How do you encode a comma?
Enclose it in quotes.
How do you encode a quote?
Double it!
My practical interpretation:
Define a system: There will always be something outside of its boundaries!
My favorite example is good old
int getc();
It returns a char or -1 for EOF/End of File. EOF is outside of the char system.
|
|
|
|
|
|
In a certain village, a barber shaves all those who do not shave themselves. Who shaves the barber?
"A little song, a little dance, a little seltzer down your pants"
Chuckles the clown
|
|
|
|
|
The famous Russel's Paradox, from what i remember.
|
|
|
|
|
Behind every paradox lies a Cretan.
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
A rule having no exception: "death and taxes"
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I once discussed that with my religious brother-in-law. He insisted that there are exceptions to that rule. May not to the "taxes" part, though.
Religious freedom is the freedom to say that two plus two make five.
|
|
|
|
|
Amarnath S wrote: Would you agree with this conclusion? If so, is there any example of a rule having no exception?
Agreeing that a proof is valid is not the same as stating that it must be true. Now claiming that it is true could suggest that one should provide the example. Or provide other discussions that would suggest it is true. Or just believe and dispense with the work.
My favorite example with this is geometry (Euclidean) where parallel lines do not intersect. I certainly believe it. And I doubt anyone can provide an example that shows they do intersect. But for that matter they cannot provide an example where they do not intersect either.
|
|
|
|
|
jschell wrote: parallel lines do not intersect
Though I am not a theoretical physicist, have heard that "space is curved", whatever it means. If space is curved, will there be a possibility of parallel lines meeting? Not sure.
|
|
|
|
|
Amarnath S wrote: will there be a possibility of parallel lines meeting
Spherical geometry rather than Euclidian.
But one can also start in on a definition since a line, even theoretical, could still be claimed to be something that must exist in the universe. So if the universe is curved then the line must be as well.
But then what happens with the degrees in a right triangle which can only exist if those lines do not intersect.
|
|
|
|
|
The exception for statement 1 is no exception. Doh
"A little time, a little trouble, your better day"
Badfinger
|
|
|
|
|
You :
does a solution to the Russel Paradox exist
ChatGPT
Yes, several solutions to the Russell Paradox exist, which emerged after Bertrand Russell presented the paradox in 1901. One common solution is to restrict the comprehension principle, which states that for any property, there exists a set of all objects that have that property. By restricting this principle, mathematicians and logicians have been able to formulate set theories, like Zermelo-Fraenkel set theory (ZF) or von Neumann-Bernays-Gödel set theory (NBG), which avoid the paradox by disallowing the formation of certain "self-referential" sets. Another approach is to distinguish between sets and classes, where classes can contain sets but not be sets themselves, thereby sidestepping the contradiction. These solutions have allowed set theory to develop into a foundational framework for mathematics without succumbing to paradoxes like Russell's.
Me : If Statement 2 is a rule it must have an exception.
Conclusions: Statement 1 has no exception. There is at least one rule which has no exception.
|
|
|
|
|
All generalities are false.
|
|
|
|
|
Wordle 1,045 2/6
⬛⬛⬛⬛🟩
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,045 4/6
⬜🟨🟩⬜⬜
🟨🟩🟩🟨⬜
🟩🟩🟩🟨⬜
🟩🟩🟩🟩🟩
|
|
|
|
|
Wordle 1,045 3/6
⬜⬜🟩🟨⬜
⬜🟩🟩⬜🟩
🟩🟩🟩🟩🟩
|
|
|
|