- Variable declaration syntax - 23 Updates
- Virtual functions - 2 Updates
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 05:48AM -0700 Has there ever been a proposal to the C++ standards committee to have something like this: 01: CWhatever *a, b; 02: CWhatever* a, b; 01 produce a pointer to an instance of CWhatever in a, and it allocates an actual CWhatever for b, while the declaration in 02 to produce pointers to instances of CWhatever for both a and b? Basically, to have the compiler look at the type as it exists con- tiguously, and apply it in that contiguous fashion (comparing the "[CWhatever][space][asterisk]" to "[CWhatever][asterisk][space]"), indicating [CWhatever] in the first, and [CWhatever*] combined in the second, because of the contiguous nature of the declaration. I use this a lot, and I do not like it makes sense to write: 03: CWhatever* a, *b; Or: 03: CWhatever* a; 04: CWhatever* b; Seems the syntax could be improved to be this: 03: CWhatever* a, b; // Both are declared as pointers // because the type is "CWhatever*" // and not just CWhatever and a tag // for variable #1 that it, and it // alone, is a pointer. -- Rick C. Hodgin |
bartc <bc@freeuk.com>: Apr 09 02:10PM +0100 On 09/04/2018 13:48, Rick C. Hodgin wrote: > allocates an actual CWhatever for b, while the declaration in > 02 to produce pointers to instances of CWhatever for both a > and b? So, C++ syntax isn't complicated or ambiguous enough, it's necessary to make white space significant? I'll go along with that (since I'm never going to use C++ anyway)... -- bartc |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 02:51PM +0100 On 09/04/2018 14:10, bartc wrote: > So, C++ syntax isn't complicated or ambiguous enough, it's necessary to > make white space significant? > I'll go along with that (since I'm never going to use C++ anyway)... Significant whitespace is the worst idea ever and I refuse to use languages that use it (e.g. Python). /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 09:51AM -0400 On 4/9/2018 9:10 AM, bartc wrote: >> and b? > So, C++ syntax isn't complicated or ambiguous enough, it's necessary to > make white space significant? I think both 01 and 02 above producing the same declarations is very confusing. It's burned me a few times when I've looked at code, or gone to create new variables. I would much rather see 02 produce two pointers. My C-like language operates that way. When enabled, whatever is declared contiguously becomes the full de facto type for every reference thereafter. By default it works as above for backward compatibility. -- Rick C. Hodgin PS -- The email address you post under is not valid. I accidentally clicked "Reply" instead of "Follow-up" and it was immediately returned. |
David Brown <david.brown@hesbynett.no>: Apr 09 03:52PM +0200 On 09/04/18 14:48, Rick C. Hodgin wrote: > allocates an actual CWhatever for b, while the declaration in > 02 to produce pointers to instances of CWhatever for both a > and b? I am sure you are not the first person to want this. But I think most people would find it confusing and inconsistent if C++ worked this way, and since both currently mean the same thing ("a" is a pointer, "b" is an object) then there is absolutely zero chance of it being changed - it would break lots of code. > the second, because of the contiguous nature of the declaration. > I use this a lot, and I do not like it makes sense to write: > 03: CWhatever* a, *b; Don't write that. It would confuse people (yourself included). > // and not just CWhatever and a tag > // for variable #1 that it, and it > // alone, is a pointer. If you were designing a non-C language from scratch, you might want to do something like that. But C++ will never change in this regard. And if you follow C++ (and modern C) common practice of almost always initialising your variables on declaration, there is no question of how to do it: CWhatever *a = new CWhatever; CWhatever b = *a; A single declaration and initialisation per line is common. Usually you should not declare your variable until you have something useful to put in it. Sometimes, because of scoping, you need a declaration earlier. Even then, you usually want to keep one declaration per line. The exception is a bunch of related variables - like "int x, y, z;". Don't mix types, pointers, references, etc., in the same declaration. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 02:54PM +0100 On 09/04/2018 14:51, Rick C. Hodgin wrote: > operates that way. When enabled, whatever is declared contiguously > becomes the full de facto type for every reference thereafter. By > default it works as above for backward compatibility. Your language is toy and this behaviour is probably at the top of the list of reasons why: language syntax being predicated on a compiler setting is an even worse idea than significant whitespace. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 09:58AM -0400 On 4/9/2018 9:51 AM, Mr Flibble wrote: >> So, C++ syntax isn't complicated or ambiguous enough, it's necessary >> to make white space significant? > Significant whitespace is the worst idea ever One of my goals for my C-like language is to allow whitespaces in names. To this end, I allow a ctrl+spacebar to introduce a linked whitespace, which is a connector of related name components. Internally it's stored as the \377 character (ASCII 255). I have used it in Visual FreePro already since 2014: (See upper-left editor image) http://www.visual-freepro.org/images/vjr_054.png It puts a blue line underneath linked name portions, uses a half- indent on the left-and-right side, and averages out the remaining pixels within the normal space allocated, so the internal spaces actually take up less space than a real whitespace, but are still a clear indicator for the eye. > and I refuse to use > languages that use it (e.g. Python). Okay. -- Rick C. Hodgin |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 07:04AM -0700 On Monday, April 9, 2018 at 9:54:57 AM UTC-4, Mr Flibble wrote: > Your language is toy and this behaviour is probably at the top of the > list of reasons why: language syntax being predicated on a compiler > setting is an even worse idea than significant whitespace. My C-like language is called "CAlive" for two reasons. Second, because I am trying to inject some life back into C (adding the class, exceptions, a few other things). It also serves the primary meaning of a reminder that Jesus Christ is alive. The entire language is offered to Him, as the best I'm able to produce given the skills He has given me. It may be "toy" to other people, but it's the best I have, Leigh. And I give it to Him by name explicitly. What would you say to your child if they gave you something they created by their own choice to do so just for you, yet it wasn't as good as you could've done had you been there to aid them during the project? As I recall, you've rejected my calls when I've repeatedly asked for help. You hold my love of Jesus Christ as the primary reason you won't engage me in technical matters. You seem to only drop by to disparage my work and call me horrible names. That's a testimony I would worry about if it came from my life. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 03:09PM +0100 On 09/04/2018 14:58, Rick C. Hodgin wrote: > used it in Visual FreePro already since 2014: > (See upper-left editor image) > http://www.visual-freepro.org/images/vjr_054.png Worst. Idea. Ever. As to your deliberate indirect spamming of Christian iconography to try to push your agenda: speed of light mate. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Bo Persson <bop@gmb.dk>: Apr 09 04:23PM +0200 On 2018-04-09 15:52, David Brown wrote: > and since both currently mean the same thing ("a" is a pointer, "b" is > an object) then there is absolutely zero chance of it being changed - it > would break lots of code. And even if we were to define those examples, we would then have to consider the meaning of 03: CWhatever * a, b; 04: CWhatever*a,b; And now we are closing in on madness. Bo Persson |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 03:25PM +0100 On 09/04/2018 14:52, David Brown wrote: > then, you usually want to keep one declaration per line. > The exception is a bunch of related variables - like "int x, y, z;". > Don't mix types, pointers, references, etc., in the same declaration. +1 for one declaration per line. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 07:28AM -0700 On Monday, April 9, 2018 at 10:09:15 AM UTC-4, Mr Flibble wrote: > > (See upper-left editor image) > > http://www.visual-freepro.org/images/vjr_054.png > Worst. Idea. Ever. It's been incorporated into other database languages, such as Microsoft's TSQL (in TSQL you have to use [brackets for any] names with spaces). > As to your deliberate indirect spamming of Christian > iconography to try to push your agenda: speed of light mate. Everything I've done personally since July 12, 2012 has been done for Jesus Christ, Leigh. I thought long and hard about what it means to be a Christian, and I have incorporated that understanding into my life. It's daily. It's active. It's in everything I do. I still fail a lot because I am tied to this flesh, and I am consistently hit with rhetoric from the unsaved which is designed to discourage me, to prevent me from moving forward, to harm me in various ways. It's the life of a Christian, Leigh. We are abused hard all day long by those who are perishing because they don't want to face the reality that God exist, and that they are under judg- ment. It's very hurtful to be attacked continually like this, but we endure it because we know who it is we serve. He is worth all the pain, all the loss, all the damage done by others. He was humiliated in this world, and rose in full power. We are to take up our cross daily and follow Him ... and our fate may well be the same as His, to suffer greatly in this world, but to then rise in full power as He gives to us, enduring and shining like the stars forever. It's much better than a fair trade. Temporary pain here, and a life lived in His Kingdom with Him forever. It's an easy choice. -- Rick C. Hodgin |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 09 03:38PM +0100 On Mon, 9 Apr 2018 14:51:32 +0100 > > anyway)... > Significant whitespace is the worst idea ever and I refuse to use > languages that use it (e.g. Python). Your programming choices then are going to be severely limited. I cannot immediately think of one where whitespace is not significant except brainfuck. Good luck with that one. C++ for the most part inherits C's tokenizing. When tokenizing, "+ +" is not the same as "++", "< <" is not the same as "<<" and so on. Whitespace is significant in the pre-processor as well. That's not to say that I agree with Rick's views. He is obviously severely up his backside on this one. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 03:39PM +0100 On 09/04/2018 15:28, Rick C. Hodgin wrote: > It's been incorporated into other database languages, such as > Microsoft's TSQL (in TSQL you have to use [brackets for any] > names with spaces). You can visually see those brackets so that is slightly less egregious than your idea but only slightly less. > moving forward, to harm me in various ways. > It's the life of a Christian, Leigh. We are abused hard all > day long by those who are perishing because they don't want to You are mistaken; you are not being ridiculed your beliefs are. It is you who chose to conflate the believer with their beliefs: I never do that. People are free to believe whatever nonsense they want and I would defend their right to do so however that does not mean that I have to respect those beliefs. > like the stars forever. > It's much better than a fair trade. Temporary pain here, and a > life lived in His Kingdom with Him forever. It's an easy choice. And what if you are wrong? You have been putting up with misplaced ridicule for no reason wasting so much time defending the indefensible in the process. Are you wrong? Speed of light mate. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 07:40AM -0700 On Monday, April 9, 2018 at 10:28:22 AM UTC-4, Rick C. Hodgin wrote: > this flesh, and I am consistently hit with rhetoric from the > unsaved which is designed to discourage me, to prevent me from > moving forward, to harm me in various ways. One other thing ... the vision I've had is to create a complete computer system from hardware to operating system to drivers to compilers to user apps, all as an offering to Jesus rather than to self, to a corporation, to money, or some other purpose. It is an offering to Him, and to all of mankind, all free and open, the best we're able to produce (Christians working together on this project), so that people can have a complete computer for their use free from all IP and licensing entanglements. It is a goal to take what God gives us first, and give it back to mankind. With regards to whitespace variable names, it is part of a much more comprehensive vision than Ctrl+spacebar. I began working on a keyboard design for this hardware platform, which incorporates a three-key spacebar. One of those is for whitespaces in contiguous names: http://www.libsf.org:8990/projects/LIB/repos/libsf/browse/ukm/keyboard/graphics/key_assignments_empty.png ----- The vision I have is a comprehensive vision. I do not want to do it alone, but I am proceeding on it because it's all I have. It incorporates my interests (hardware and software design), and it is using the skills He first gave me in a way designed explicitly to honor Him. I mention all of this to you because you seem to think I am not a well thought out individual. I spend a great deal of time regularly reflecting on and examining the path of my life. I make purposeful adjustments to things as I go, and following much prayer and real contemplation. There is nothing I do that is "toy." It is me on my knees, looking up, seeing what I am able to do in this world, and moving forward with it, trusting in the Lord to bring it to fruition, because it is only by Him that any of us (non-believers included) achieve any degree of success in this world (yourself included). Without Him there to give you that success, it never would've been yours. So my apparent failures are not failures, but are simply me being obedient to Him until His time brings them to fruition. I press on because I desire these things, and He knows perfectly well what my true intentions are. I move heartily unto Him, always looking up and doing my best. And I fail a lot in the world's eyes, but as I press on I succeed a lot in His eyes because I am not dis- couraged by the world, only hindered by it, and even then only be- cause He allows me to be hindered by it. I trust in the Lord, Leigh. And I bring that faith to bear in all areas of my life. -- Rick C. Hodgin |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 07:42AM -0700 On Monday, April 9, 2018 at 10:39:32 AM UTC-4, Mr Flibble wrote: > > names with spaces). > You can visually see those brackets so that is slightly less egregious > than your idea but only slightly less. You can visibly see the blue underline on the variable in my design. I actually incorporated that design because I wanted it to be less syntactically obtuse than something like brackets. -- Rick C. Hodgin |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 03:45PM +0100 On 09/04/2018 15:38, Chris Vine wrote: > C++ for the most part inherits C's tokenizing. When tokenizing, "+ +" > is not the same as "++", "< <" is not the same as "<<" and so on. > Whitespace is significant in the pre-processor as well. We are talking about the significance of whitespace AFTER preprocessing/tokenization. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 10:47AM -0400 On 4/9/2018 10:23 AM, Bo Persson wrote: > 03: CWhatever * a, b; > 04: CWhatever*a,b; > And now we are closing in on madness. In my opinion, two warnings are issued: 03 -- "ambiguous declaration, assuming type CWhatever* for a, CWhatever for b." 04 -- "ambiguous declaration, assuming type CWhatever* for a, b." And any alternate uses of those types would produce relative errors, with the diagnostic there to aid in discovery / recovery. -- Rick C. Hodgin |
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Apr 09 10:51AM -0400 On 4/9/2018 10:45 AM, Mr Flibble wrote: > On 09/04/2018 15:38, Chris Vine wrote: > We are talking about the significance of whitespace AFTER > preprocessing/tokenization. In the case of CAlive and Visual FreePro, Jr., they are not whitespaces but are linking spaces, a completely different character that is readily tokenized out during lexing and grouping together of co-joined symbols. From that point forward, the alphanumeric form of the variable name is all that remains as a thing in the language, making it easy to handle. The only unusual thing I had to add was a unique way to render that component. But, since my editor is linked directly to my compiler, the fact that the compile-time information is already there is the benefit which made it easy. I simply render the name like normal, and then post-process and re-render the one component using the high- lighted syntax. I can teach you how to do it if you like. -- Rick C. Hodgin |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 09 03:57PM +0100 On Mon, 9 Apr 2018 15:45:17 +0100 > > Whitespace is significant in the pre-processor as well. > We are talking about the significance of whitespace AFTER > preprocessing/tokenization. No we weren't. You would have to change the lexing rules to implement his daft idea. And you would have to do the same to implement python style significance, whereby whitespace replaces braces. Anyway tokenizing is an implementation issue. There is no one way to scan and tokenize a line of code and build up your AST. In the C++ language, whitespace is significant. Just not in the way it is in python. |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 03:58PM +0100 On 09/04/2018 15:40, Rick C. Hodgin wrote: > cause He allows me to be hindered by it. > I trust in the Lord, Leigh. And I bring that faith to bear in > all areas of my life. If they gave out awards for how to waste the most time you would win the award for greatest time waster in the universe. You remind me of Terry A. Davis who is doing a similar thing with his TempleOS but at least you don't appear to be shouty racist like Terry which is a +1 for you. Seriously mate you need to stop wasting time on religiously themed wheel reinvention vanity projects and do something more useful with your time. How much time have you got? Try to answer that question whilst pretending that there is no afterlife and this is the only life you get: YOLO. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 03:59PM +0100 On 09/04/2018 15:57, Chris Vine wrote: > scan and tokenize a line of code and build up your AST. In the C++ > language, whitespace is significant. Just not in the way it is in > python. Obviously I am talking about how whitespace is significant in Python. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Apr 09 04:01PM +0100 On 09/04/2018 15:51, Rick C. Hodgin wrote: > benefit which made it easy. I simply render the name like normal, > and then post-process and re-render the one component using the high- > lighted syntax. Linking the editor directly to the compiler is yet another bad idea (YABI). > I can teach you how to do it if you like. Based on all previous interactions it is higly unlikely that you can teach me anything either on theology or software engineering. /Flibble -- "Suppose it's all true, and you walk up to the pearly gates, and are confronted by God," Bryne asked on his show The Meaning of Life. "What will Stephen Fry say to him, her, or it?" "I'd say, bone cancer in children? What's that about?" Fry replied. "How dare you? How dare you create a world to which there is such misery that is not our fault. It's not right, it's utterly, utterly evil." "Why should I respect a capricious, mean-minded, stupid God who creates a world that is so full of injustice and pain. That's what I would say." |
"Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>: Apr 09 02:54AM +0200 On 08.04.2018 19:16, Tim Rentsch wrote: > process of higher education, especially in the sciences, generally > acquire a sense that it is important to be precise in their use of > language. "Static polymorphism" is a far more precise term than "ad hoc polymorphism". That doesn't support your explanation. ;-) [snip] Cheers!, - Alf |
Chris Vine <chris@cvine--nospam--.freeserve.co.uk>: Apr 09 02:25PM +0100 On Sun, 08 Apr 2018 09:37:15 -0700 > legalize+jeeves@mail.xmission.com (Richard) writes: > > Tim Rentsch <txr@alumni.caltech.edu> spake the secret code [snip] > a lot of overlap between the writings on the two languages, so > it's hard to say where the terms originated. But certainly they > are used in both.) I don't really think your criticisms (if they were intended as that) hold much water. In all fields of activity which develop their own terms of art, words acquire special meanings within that activity which they do not hold outside it, C++ included. You mention "functor", and that is actually a good example of this. In Haskell, which may be what you have in mind, it happens to be associated with category theory's use of the word; but in other programming languages it means something completely different. In ML, another family of functional programming languages, it means a function or operator which can be applied to a module and which returns a module. In C++ it happens to mean a class type with a function application operator. That's absolutely fine. And C++'s use of "signature" to describe how overloading works is also fine in my view. Again, in other languages it means different things - in ML it is used to describe the interface of a module. There is nothing odd in my view about C++'s use of the words "base class" and "derived class", and they are understood to be interchangeable with superclass and subclass respectively. And I think "concept" is fine for describing C++'s brand of type classes. C++'s approach to typing seems to me to make its use of the expressions "static polymorphism" and "dynamic polymorphism" also reasonable. C++ typing does not work in the same way as some other languages which use type inference. Overloading provides what is sometimes called ad-hoc polymorphism; function templates perform the role of parametric polymorphism; and class templates provide generics. Virtual functions provide what is sometimes called sub-type polymorphism. Lumping the first lot together as static (compile-time) polymorphism and the last as dynamic (run-time) polymorphism seems to me to be fine, since that is how C++ works. Chris |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment