Thread: HyperC

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,436
    Turning C into Perl, one graphic character at a time.

    You turned printf into ink.
    What if I want to print to stderr, or indeed any other open file?

    You turned if/else into case.
    What if I want to use an actual switch/case ?


    > code writing efficiency
    When you get past the student homework phase, you're going to be spending more time reading lots of documentation, design, other code than actually writing new code.

    The modern trend is creating languages which are easy to read and understand by humans. Programs are read by humans far more often than they are written by humans (if you exclude the write once, read once, throw away student assignments).

    HyperC fails so miserably on the readability scale because you seem to think that the only thing that matters is keystrokes when entering the program for the first time.

    I'm reminded of this.
    Question 10.2

    And this.
    The International Obfuscated C Code Contest
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,087
    Quote Originally Posted by Structure
    So that you can easily see the value type and there is no confusion as to what is happening
    That's not a bad goal, but C's printf already provides that with the format specifers. Contrast:
    Code:
    printf("x=%lu", x);
    With HyperC:
    Code:
    ink "x=" unsigned long x;
    It is clear that for the goal of "code writing efficiency", C's printf wins against HyperC's ink while being equal in the goal of "no confusion as to what is happening" except for the special cases of int, double and char (but then the shortcuts for these are arguably cryptic, which is a minus point for the latter), i.e., HyperC's syntax sucks when measured against its stated language design goals. Whereas if HyperC left out the type requirement:
    Code:
    ink "x=" x;
    HyperC would win in the former; and while C might have a slight advantage in the latter, it can be mitigated by code hinting tools that are widely available among editors/IDEs these days, i.e., HyperC's syntax would now be good when measured with its stated design goals.

    Furthermore, I note that in your documentation under "variables", you state that "$ = CHAR", but in post #10 you state that "$ is a string".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147
    When you get past the student homework phase
    next...


  4. #19
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147

    Post

    if HyperC left out the type requirement
    This is an interesting concept. I would agree it sounds good and i will take a look at implementing such a thing. It actually opens up a lot of things as far as not just for ink. My only issue is being able to see the variable type quickly when looking at it.

    you state that "$ = CHAR", but in post #10 you state that "$ is a string"
    Aside from the confusion... like i said it's beta and i appreciate the comments.
    Last edited by Structure; 09-13-2019 at 09:08 AM.


  5. #20
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147
    FYI: this works...
    Code:
    @{
        $*str = "testing";
        ink "%s", str;
    };


  6. #21
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147

    Cool HyperC tips...

    including files:
    Code:
      :>filename.c;
    using with ;
    with prepends to every line.
    setting with to nothing escapes it.
    Code:
    with someObject.;
      name = "testing";
      number = 001;
    with;
    using and ;
    and appends to every line.
    setting and to nothing escapes it;
    Code:
    and "\n";
      ink "line 1";
      ink "line 2";
      ink "line 3";
    and;
    example:

    Code:
     loop 1 to 15 as i {
       with ink ; and "\n";
          "line %i", i;
       and;with;
     };
    Last edited by Structure; 09-13-2019 at 10:04 AM.


  7. #22
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147
    easy to read and understand by humans
    HyperC is for developers

    why does HyperC require every line of code to end in a semi-colon
    so that you are free to structure code in any way you like.
    such as long lines of multilines, even the whole project in one line if you want.

    you seem to think that the only thing that matters is keystrokes


    HyperC's syntax would now be good when measured with its stated design goals.
    interesting...
    Last edited by Structure; 09-13-2019 at 10:26 AM.


  8. #23
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,087
    Quote Originally Posted by Structure
    HyperC is for developers
    Have you forgotten that (other than specialised AI), developers are humans?

    Quote Originally Posted by Structure
    so that you are free to structure code in any way you like.
    such as long lines of multilines, even the whole project in one line if you want.
    Why not make them optional for such cases instead? After all, what you have described are generally coding anti-patterns or would be automated (as in the case of compressed Javascript), so they shouldn't see much use being written by developers beyond obfuscated code contests.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #24
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147

    Cool

    Why not make them optional
    Semicolon - Wikipedia

    this was a divisive issue in programming languages from the 1960s into the 1980s.
    two statements are placed on the same line; this is legal, because the semicolon separates the two statements.
    The semicolon, as a mark separating statements, corresponds to the ordinary English usage of separating independent clauses, and gives the entire program the gross syntax of a single ordinary sentence.


  10. #25
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,087
    You should actually make an argument supporting your own language's design goals rather than just quote wikipedia.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #26
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147

    Thumbs up HyperC tips...

    When compiling you can use -x to skip HyperC compilation.
    This can be used to create your own compilation structures...

    using
    Code:
    :>filename.ext;
    example
    Code:
    :>header.file;
    int main() {
       :>main.file;
    };
    Last edited by Structure; 09-13-2019 at 11:54 AM.


  12. #27
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147

    Thumbs up example...

    Code:
    <stdio.h>;
    
    @numbers( #one, #two) {
      ink "%i\n", one;
      case one != two {
        case one > two {
          one--;
        } || two > one {
          one++;
        };
        numbers(one,two);
      };
    };
    
    @{
        float n = 0;
        ink "Enter Number: ";
        scanf( "%f", &n );
        numbers( 1, n );
    };


  13. #28
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147

    Post

    What if I want to use an actual switch/case ?
    It works.

    Code:
      a = 1; b = 2;
      case b == 2 {
        switch (a) {
          case 1:
            ink "it works.";
          break;
        };
      };
    ink "x=" unsigned long x;
    invalid.

    you're going to be spending more time reading lots of documentation, design, other code than actually writing new code
    false.
    Last edited by Structure; 09-13-2019 at 12:58 PM.


  14. #29
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,087
    If this is invalid:
    Code:
    ink "x=" unsigned long x;
    Why is this valid?
    Code:
    ink "x=" #x;
    HyperC looks to be so inconsistent as to be unusable.

    Are you familiar with expressing grammar formally? At the moment it looks like you're mostly making things up and so there's no rhyme or reason as to why some syntax is valid whereas other syntax is invalid.
    Last edited by laserlight; 09-13-2019 at 01:01 PM.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  15. #30
    null pointer Structure's Avatar
    Join Date
    May 2019
    Posts
    147
    HyperC looks to be so inconsistent
    These are also valid:
    Code:
      printf("x=%lu", x);
    Code:
      ink "x=%lu", x;
    Are you familiar with expressing grammar formally?
    no.

    making things up
    I built HyperC...
    Last edited by Structure; 09-13-2019 at 01:08 PM.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. HyperC Pre Process File Injection
    By Structure in forum Tech Board
    Replies: 2
    Last Post: 08-06-2019, 06:13 AM
  2. The future of the C language is HyperC
    By Structure in forum Projects and Job Recruitment
    Replies: 6
    Last Post: 05-14-2019, 08:55 AM

Tags for this Thread