Forums

static class problem

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

static class problem

Postby arisawa » Tue Jun 30, 2009 1:10 am

seem to be Cobra make a constructor into static class.
did not pass to compile.

or..., forgot to write a keyword or something that I :? ?
arisawa
 
Posts: 51

Re: static class problem

Postby Charles » Tue Jun 30, 2009 1:22 am

Code sample please.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: static class problem

Postby arisawa » Tue Jun 30, 2009 2:17 am

sorry, I had forgotten the sample code is taken care of translation :oops:
it is as follows:
@args t:lib
class AdditionalName is shared
pro cobra as String is shared
get
return "Arisawa"
arisawa
 
Posts: 51

Re: static class problem

Postby Charles » Tue Jun 30, 2009 4:15 am

At the very least, you need a "set" to complete the "pro".

Also, I don't think Cobra supports "shared" at the class level, but you could do this:
class X

shared

pro x as int
get
return 0
set
pass

def hello
print 'hi'
Maybe that helps.

Also, we're now giving support at http://cobra-language.com/trac/cobra/wiki/IrcChannel as well. And webnov8 is working on a cobrabot in Cobra to do the logging.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: static class problem

Postby arisawa » Wed Jul 01, 2009 8:55 pm

support thanks.

by the way, I was ready to participate in the IRC.
however, I am not English speaker.
I requires a lot of time on writing and reading.

may be heavy load for me.
can you still support in the forum?
arisawa
 
Posts: 51

Re: static class problem

Postby Charles » Wed Jul 01, 2009 9:34 pm

Oh sure. We'll always support in both the forum and irc from now on. They have pros and cons.
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: static class problem

Postby hopscc » Tue Jul 07, 2009 3:11 am

Also, I don't think Cobra supports "shared" at the class level,


Is there a particular philosophical reason for that or is it just an NYI item ?
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: static class problem

Postby Charles » Tue Jul 07, 2009 9:24 pm

I'm not convinced it's needed. It's so easy to put "shared" on a line and put everything under it. And now that we can write "extend String ..." I'll never write another "class StringUtils" ever again. Goodbye procedural coding.

Anyone else have opinions on this?
Charles
 
Posts: 2515
Location: Los Angeles, CA

Re: static class problem

Postby todd.a » Mon Sep 28, 2009 1:05 pm

Funny, I've made this mistake in the past too. It's probably C# syndrome where you can make a method and a class static with similar syntax.

My opinion would be to have this just to avoid an indentation level if you know the entire class is going to be static/shared. I know there are plans to have umbrella style private/protected like shared, which will be great because sometimes I don't like using underscores because it gets ugly after a while.
todd.a
Site Admin
 
Posts: 81
Location: Chicago, IL

Re: static class problem

Postby hopscc » Mon Sep 28, 2009 7:06 pm

Added ticket:179 as a reminder for this.

bring out yer patches...
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Next

Return to Discussion

Who is online

Users browsing this forum: No registered users and 49 guests