Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Languages

Languages

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1  2 

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #15 on Wed 10 Nov 2004 08:08 AM (UTC)
Message
That's VB only, in VBScript you get an error if you declare something as a type. By the way, Shadowfyr, I'm curious to see how you indent, could you paste a sample? :p

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #16 on Wed 10 Nov 2004 04:29 PM (UTC)

Amended on Wed 10 Nov 2004 11:16 PM (UTC) by Shadowfyr

Message
That entirely depends on the language Poromenos. With VBScript it is a tad easier, but with something more C like, such as the POVRay SDL, you can do it several dozen ways:

sphere{<0,0,0>,1 pigment{color rgbt <1,1,1,1>}}

sphere {<0,0,0>,1
  pigment{
    color rgbt <1,1,1,1>
  }
}

sphere
  {<0,0,0>,1
  pigment
  {
    color rgbt <1,1,1,1>
  }
}

And so on... I generally use two spaces and the second format, but others might use three spaces, tabs, or any number of different points of indention. However, if the SDL 'required' you to indent as part of the language, you wouldn't get 3D signitures or one line shortest code contests entries like:

background{rgb<.5.7,1>}global_settings{radiosity{error_bound.5count 99}ambient_light#local _=function{pattern{agate turbulence 1octaves 9}}0}isosurface{function{(y+.07-_(x+9,y,z)*.115)/20}accuracy 1e-5pigment{rgb 1}}light_source{5<8,4,2>}

You can see the result of this as the second one down at this site:

http://astronomy.swin.edu.au/~pbourke/povray/scc3/final/

Yeah, that is a bit of a silly reason to not use indention, but the point is, the option exists. ;)
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #17 on Wed 10 Nov 2004 10:13 PM (UTC)
Message
Did you forget to add the code tags to that? I don't see the spaces. Also, I agree with the special syntax (I enjoy the looks on people's faces when they see my database program spelled out as large "Poromenos" ASCII art :), but you can't do that in VB either, and if you have a language whose line endings are \n you might as well take it a step further and enforce indentation, since it is very ugly to see unindented code. So, essentially, the argument is a C-style vs VB-style one, and not at all about enforcing indentation.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #18 on Wed 10 Nov 2004 10:55 PM (UTC)
Message
It's not a C vs. VB argument. What you're talking about - the ASCII art - is "cute". When one writes code for real, one does not write "cute" code. There are tons of reasons, for instance cute code is extremely difficult to maintain. If you were a programmer and turned in code that wasn't indented according to the company style guides, people would be very unhappy with you. If you're a student in a programming class and don't turn in indented code, your grader will be very unhappy with you. If you're just submitting random code to your peers, they'll be unhappy with you if it's not indented.

'Cute' code certainly has its purposes, e.g., well, when you're trying to be cute. :) But when you're trying to write a program that does something useful and that you plan on maintaining, expanding and debugging, 'cute' good is a Very Bad Idea no matter what language it's in.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #19 on Thu 11 Nov 2004 01:35 AM (UTC)
Message
Quote:

(I'm telling you, Nick. Don't play with it [Python] or you will never use VB script again.)


Well, I have been playing with Lua recently, and am rather impressed with that. However I haven't found a COM interface for it yet, so if that were to be added to MUSHclient it would be a bigger undertaking.

As for what Poremenos was talking about, there are competitions for who can write the most obscure C, obviously not for any sort of production environment.

See this site: http://www.ioccc.org/

Here is an example:


#include <stdio.h>
int l;int main(int o,char **O,
int I){char c,*D=O[1];if(o>0){
for(l=0;D[l              ];D[l
++]-=10){D   [l++]-=120;D[l]-=
110;while   (!main(0,O,l))D[l]
+=   20;   putchar((D[l]+1032)
/20   )   ;}putchar(10);}else{
c=o+     (D[I]+82)%10-(I>l/2)*
(D[I-l+I]+72)/10-9;D[I]+=I<0?0
:!(o=main(c/10,O,I-1))*((c+999
)%10-(D[I]+92)%10);}return o;}

Operation

Compile normally and run with one argument, an integer with 2n digits.

Program will return the integer part of its square root (n-digits).

For example,

       > gcc -o cheong cheong.c
       > cheong 1234567890
       35136
       > cheong 0200000000000000000000000000
       14142135623730
       >


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Jestre   (13 posts)  Bio
Date Reply #20 on Thu 11 Nov 2004 05:56 AM (UTC)
Message
I use Python for scripting. That's what made me use Mushclient.

I must agree with Nick on Lua too. Its really nice. I also like Ruby but that isn't supported.
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #21 on Thu 11 Nov 2004 08:12 AM (UTC)
Message
Cuteness isn't very bad as long as it's optional. You still can be cute or indent and be pretty whenever appropriate. And yes, the Obfuscated C Contest has some great programs :P There's one where the entire program is written in preprocessor directives, try to find it. I still don't know how he did that :P

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #22 on Thu 11 Nov 2004 07:03 PM (UTC)
Message
Trust me, if you ever have to maintain a large codebase that does something moderately useful, the last thing you will want to see is somebody being "cute" if that means you have to spend even just a few more minutes trying to figure out what they were trying to do/say. :-)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #23 on Thu 11 Nov 2004 07:33 PM (UTC)
Message
You obviously wouldn't do that, since "cute" code might be very cute, but it's impossible to debug. I'm talking about this:


s::l86                      );;;l33=
e.  l87    ();   y(1)       ;}h   l31  ::l35     (v  &r){r   .l41    ((a*)  &q ,x        (q))    ;r.l41    ((a*)     &l33,x
(l33))      ;y    (1)       ;;}l31::  l31   (){  u();;      }h   l31  ::  l67  (l26   a*l36,l26  a*   l37 ){v    r;   l38
l40  ;r.    l39  (l36       ,s        ::   l54    |s       ::    l46  );   l40  .l39   (l37      ,s    :: l72    |s    ::l46
|s::l69       );c(r.        l42         ()||     l40         .l42     ()    )y   (0)      ;l35(  r);  l45  ();l63   (r,l40
                  );
             r.l47
();l40.l47();y(1);}l28 l31::l63(v&e,l38&p){f a n=0;f a z=0;f a k=0;h g=0;f l79 l66=l33;w*b=d;l48(l66){c(!k){e.l41((a*
        )&n,x(n));c(e.l60())l59;k=128;}z=n&k;k>>=1;c(z)b=b->m;t b=b->j;c(b->l34){p.l43((a* )&b->l27,x(b->l27
            ));l66--;b=d;}}}l28 l83(h l80,a*l30[]){l32 l52;l31 l65;c(l80==4){c(l76(l30[1],"\x2d\x63")==
                0&&l52.l49(l30[2]))l52.l58(l30[2],l30[3]);t c(l76(l30[1],"\x2d\x64")==0&&l65.l49(
                                   l30[2]))l65.l67(l30[2],l30[3]);}}

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #24 on Thu 11 Nov 2004 07:45 PM (UTC)
Message
That's exactly the kind of stuff I'm talking about. Sure, it's nice to be able to write "cute" code for "cute code contests" or "hard to read code contests" but beyond that, the ability to write "cute" code is absolutely useless for any kind of production environment. In other words, the ability to not indent is only useful if you're not writing in a production environment where code is shared/maintained/developed/etc.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


88,040 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.