Page 1 of 2
static class problem
Posted:
Tue Jun 30, 2009 1:10 am
by arisawa
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
?
Re: static class problem
Posted:
Tue Jun 30, 2009 1:22 am
by Charles
Code sample please.
Re: static class problem
Posted:
Tue Jun 30, 2009 2:17 am
by arisawa
sorry, I had forgotten the sample code is taken care of translation
it is as follows:
@args t:lib
class AdditionalName is shared
pro cobra as String is shared
get
return "Arisawa"
Re: static class problem
Posted:
Tue Jun 30, 2009 4:15 am
by Charles
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.
Re: static class problem
Posted:
Wed Jul 01, 2009 8:55 pm
by arisawa
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?
Re: static class problem
Posted:
Wed Jul 01, 2009 9:34 pm
by Charles
Oh sure. We'll always support in both the forum and irc from now on. They have pros and cons.
Re: static class problem
Posted:
Tue Jul 07, 2009 3:11 am
by hopscc
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 ?
Re: static class problem
Posted:
Tue Jul 07, 2009 9:24 pm
by Charles
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?
Re: static class problem
Posted:
Mon Sep 28, 2009 1:05 pm
by todd.a
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.
Re: static class problem
Posted:
Mon Sep 28, 2009 7:06 pm
by hopscc
Added
ticket:179 as a reminder for this.
bring out yer patches...