Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Strong Sauce
Jul 2, 2003

You know I am not really your father.





Theres no vim thread so I thought I'd ask here.

I am trying to get gVim working in Windows but for some reason colorscheme doesn't seem to be actually using 256 colors. I ran a script to convert gVim colors into console vim colors, but that only made it worse.

Is there something I need to do to get it so that Windows will display more than the generic 16 color default it seems to load with?

Edit: OK nevermind, I think I mean the normal console version of vim in Windows. Seems gVim works but vim messes up the colors. Anyone know why vim isn't getting it right but gVim is?

Adbot
ADBOT LOVES YOU

clockwork automaton
May 2, 2007

You've probably never heard of them.

Fun Shoe

Strong Sauce posted:

Theres no vim thread so I thought I'd ask here.

I am trying to get gVim working in Windows but for some reason colorscheme doesn't seem to be actually using 256 colors. I ran a script to convert gVim colors into console vim colors, but that only made it worse.

Is there something I need to do to get it so that Windows will display more than the generic 16 color default it seems to load with?

Edit: OK nevermind, I think I mean the normal console version of vim in Windows. Seems gVim works but vim messes up the colors. Anyone know why vim isn't getting it right but gVim is?

I believe gvim is using it's own custom console in order to get those full colors. The windows command line really doesn't support all the colors. However, you can install a new windows console that has full color support. Personally, I use Console2 for just this purpose. It has some other nice features like tabs that makes it much more usable than the windows default.

covener
Jan 10, 2004

You know, for kids!

Strong Sauce posted:

Edit: OK nevermind, I think I mean the normal console version of vim in Windows. Seems gVim works but vim messes up the colors. Anyone know why vim isn't getting it right but gVim is?

try in a better console, like the native rxvt from cygwin?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Strong Sauce posted:

Theres no vim thread so I thought I'd ask here.

I am trying to get gVim working in Windows but for some reason colorscheme doesn't seem to be actually using 256 colors. I ran a script to convert gVim colors into console vim colors, but that only made it worse.

Is there something I need to do to get it so that Windows will display more than the generic 16 color default it seems to load with?

Edit: OK nevermind, I think I mean the normal console version of vim in Windows. Seems gVim works but vim messes up the colors. Anyone know why vim isn't getting it right but gVim is?

In Linux you get this problem because some terminals support 16 colors and some support 256. I would guess the Windows cmd.exe or whatever only supports 16 colors.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.
As part of my job, I essentially need to build a Linux distribution-on-a-distribution (think OpenCSW, Solaris folks) and I'm really interested in continuous integration for regression-testing RPM package updates. When I update a package in our local repository, I'd like to systematically rebuild all packages that depend on it and ensure they build cleanly and pass their defined tests. Looking around, it seems like the most popular open-source CI packages are Jenkins and Continuum, with some others like BuildBot being used by a couple of higher-profile projects. Can anyone comment on what seems like the best solution for what I'm trying to do?

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug
I need some Regex help. I am trying to write a regex that will match one or more sets of numbers of length 2 or 3 if the string starts with L as different match groups, but stop matching once the match fails

code:
L38 39 40 CERISE RANCH 2
L50 51 CERISE RANCH 1
L12 23 GOON RANCH 123
So for the first it should match 38, 39, and 40 as different match groups and the second should match 50 and 51. For the third 12 and 23 should match but 123 should not.

I have
code:
(\G\d{2,3})\s*
that will get the lots if the string has the L stripped off. If need be I can do this but it seems like I should be able to do this as a regular expression.

qntm
Jun 17, 2009
How's this?

code:
L(\d{2,3})(\s+\d{2,3})*

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Bob Morales posted:

In Linux you get this problem because some terminals support 16 colors and some support 256. I would guess the Windows cmd.exe or whatever only supports 16 colors.

Yeah looks like Powershell supports only 16 colors, I think I'll just stick with gVim for now since it seems to be loading themes properly.

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug

qntm posted:

How's this?

That was perfect not quite right. I think I almost had that but I didn't have the \s+ in the right place. Thank you qntm.

EDIT: Actually it's not working. For items where there are three or more matches to make it's only getting the first item and the last item.

gariig fucked around with this message at 18:34 on Mar 29, 2012

Strong Sauce
Jul 2, 2003

You know I am not really your father.





gariig posted:

That was perfect not quite right. I think I almost had that but I didn't have the \s+ in the right place. Thank you qntm.

EDIT: Actually it's not working. For items where there are three or more matches to make it's only getting the first item and the last item.

I am not an expert on regex but I don't think it's going to work with just regex since the regex itself is only looking for 2 matches so it will never be able to pick up 4 matches for a line with 4 numbers. You need to use a programming language to split out on \s+\d{2,3}

Vanadium
Jan 8, 2005

If you do something like (\d\d )+ depending on the regex library you'll be able to get multiple captures for a single grouped subexpression.

Sedro
Dec 31, 2008
How about this?
code:
L(?:(\d{2,3})\s)+
Edit: That will fail on something like `L12 23 GOON RANCH L123`
code:
L(?:(\d{2,3})\s)+.*

Sedro fucked around with this message at 19:14 on Mar 29, 2012

gariig
Dec 31, 2004
Beaten into submission by my fiance
Pillbug
Thank you Sedro the second one worked perfectly. Having to match everything at the end (.*) makes it so the L## at the end won't match.

Sedro
Dec 31, 2008
Correct, and that .* stops at a newline, although that might be implementation specific/configurable in which case you add [\n$] (match newline or end of string) to the end and/or change it to .*? to make it ungreedy.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

Sedro posted:

Edit: That will fail on something like `L12 23 GOON RANCH L123`
code:
L(?:(\d{2,3})\s)+.*
Why not
code:
^L(?:(\d{2,3})\s)+

Heisenberg1276
Apr 13, 2007
I don't know if this is the right thread. But I'm looking to implement video chat in a cross platform application I'm working on (using Objective-C on mac and C# on Windows). Does anyone know of any resources that will help or libraries I could use?

The only thing remotely close to what I'm looking for that I've found so far is SkypeKit. My C++ is pretty poor so I'd rather not have to use that. If it's the only option I guess I'll battle through somehow.

Sedro
Dec 31, 2008

Jethro posted:

Why not
code:
^L(?:(\d{2,3})\s)+
Because that will only match the beginning of the string (only the first line) and AFAIK there is no "beginning of line" anchor.

JawnV6
Jul 4, 2004

So hot ...

Sedro posted:

Because that will only match the beginning of the string (only the first line) and AFAIK there is no "beginning of line" anchor.

What goofy regex environment are you in that isn't splitting up lines for you? "undef $\"?

Fruit Smoothies
Mar 28, 2004

The bat with a ZING
So I downloaded Visual C++ 2010 Express because I've mostly programmed in PHP and Javascript these last years. The only really static, compiled work I ever did was in Borland Delphi.

I'm beginning to think that Visual C++ was a horrific choice. All the C++ tutorials I can find relate to the console-style C++ which makes a lot of sense. Apart from pointers and type casting, it's very similar to PHP, and I'm not struggling at all with it.

However, the visual side to it (IE: Managed C++ / .NET) seems to be so difficult to incorporate unmanaged code into.

Additionally, when I create an event handler, it sticks it in the header file for the form?! What? I thought the majority of app code went into cpp files?

This weirdness of code location confuses me. I'm trying to write a basic winsock client, which is simple enough in a console app. Now I wanna incorporate it into a more managed project for easier threading / class handling etc, but all the tutorials I can find seem to be for C++ rather than Visual Studio's mixture.

Should I give up and use QT? Or are there any good tutorials in Visual Studio C++, because I can't find them.

For reference, my client code is adapted from here

Look Around You
Jan 19, 2009

Fruit Smoothies posted:

So I downloaded Visual C++ 2010 Express because I've mostly programmed in PHP and Javascript these last years. The only really static, compiled work I ever did was in Borland Delphi.

I'm beginning to think that Visual C++ was a horrific choice. All the C++ tutorials I can find relate to the console-style C++ which makes a lot of sense. Apart from pointers and type casting, it's very similar to PHP, and I'm not struggling at all with it.

However, the visual side to it (IE: Managed C++ / .NET) seems to be so difficult to incorporate unmanaged code into.

Additionally, when I create an event handler, it sticks it in the header file for the form?! What? I thought the majority of app code went into cpp files?

This weirdness of code location confuses me. I'm trying to write a basic winsock client, which is simple enough in a console app. Now I wanna incorporate it into a more managed project for easier threading / class handling etc, but all the tutorials I can find seem to be for C++ rather than Visual Studio's mixture.

Should I give up and use QT? Or are there any good tutorials in Visual Studio C++, because I can't find them.

For reference, my client code is adapted from here

If you're using .Net you probably want to use C# if possible; it's a lot easier to learn and there's not as many ways to shoot yourself in the foot. If you really want it to be C++, you have to decide if you want to gently caress with managed code (which limits you to .Net/maybe Mono), or if you want to go with fully native code, in which case another library like QT or GTKmm might be better.

Drape Culture
Feb 9, 2010

But it was all right, everything was all right, the struggle was finished. He had won the victory over himself. He loved Big Brother.

The End.
C# in particular will give you intellisense which would be incredibly helpful if you have only the vaguenest sense. It doesn't work with C++/CLI in VS10 so it makes learning a bit rough. Overall most of the syntax is similar.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Look Around You posted:

If you really want it to be C++, you have to decide if you want to gently caress with managed code (which limits you to .Net/maybe Mono), or if you want to go with fully native code, in which case another library like QT or GTKmm might be better.

GTKmm is a pain to deal with properly. Just stick to the C API for GTK+ if you're going to go that route.

Fruit Smoothies
Mar 28, 2004

The bat with a ZING
I have no idea what I want to be honest. Just a nice, happy, flexible language. I wish everything was like PHP / Javascript. But I'm probably alone in my thoughts, and also wrong.

Is C# the way, then?

etcetera08
Sep 11, 2008

Fruit Smoothies posted:

I wish everything was like PHP / Javascript.

First time I've heard that in CoC...

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Fruit Smoothies posted:

I have no idea what I want to be honest. Just a nice, happy, flexible language. I wish everything was like PHP / Javascript. But I'm probably alone in my thoughts, and also wrong.

Is C# the way, then?

C# gives me the fewest "what the gently caress were these idiots thinking" moments of any language I've ever used.

ToxicFrog
Apr 26, 2008


Fruit Smoothies posted:

I have no idea what I want to be honest. Just a nice, happy, flexible language. I wish everything was like PHP / Javascript. But I'm probably alone in my thoughts, and also wrong.

Is C# the way, then?

If you want "a nice, happy, flexible language" and are jonesing for some static typing, C# is a decent choice. Personally I prefer Scala, which has a bit more of a functional-programming feel to it, but it's a fair bit more complex as well.

If you'd rather go the dynamic typing route, Python is an excellent choice, and if you already know PHP and Javascript a lot of the concepts will be familiar.

Fruit Smoothies
Mar 28, 2004

The bat with a ZING

etcetera08 posted:

First time I've heard that in CoC...

If you're not being sarcastic...
Literally, you want a function, just create it. Anonymous functions. Want a string? Fine, make a string, none of this char array nonsense. You want an integer from a string? (int)$string. Done. Also, pointers?! In both PHP and JS, you parse a variable, and it assumes you're parsing the location of that data.

Want to loop? foreach() or for(var index in array) {}.

Even with pascal / delphi - which I knew pretty well, most of my time was spent converting various objects and data types (streams arghhh) to get things to work with other things.
With PHP / Javascript, most of my time is spent writing the logic. In fact, looking at PHP / javascript, the logic is often a lot easier to see than looking at stricter languages, even like pascal. With the web languages, you don't have endless conversions, pointers and data types to work with. Just go go go. Of course, their tasks are different, which probably influences their language.

Like I said, I think I'm alone in this view :(

I honestly can not believe that we still have to tell a compiler whether our variable is a string or int!

I'm going to check out C# and see how I get on.

ninjeff
Jan 19, 2004

Fruit Smoothies posted:

If you're not being sarcastic...
Literally, you want a function, just create it. Anonymous functions. Want a string? Fine, make a string, none of this char array nonsense. You want an integer from a string? (int)$string. Done. Also, pointers?! In both PHP and JS, you parse a variable, and it assumes you're parsing the location of that data.

Want to loop? foreach() or for(var index in array) {}.

Even with pascal / delphi - which I knew pretty well, most of my time was spent converting various objects and data types (streams arghhh) to get things to work with other things.
With PHP / Javascript, most of my time is spent writing the logic. In fact, looking at PHP / javascript, the logic is often a lot easier to see than looking at stricter languages, even like pascal. With the web languages, you don't have endless conversions, pointers and data types to work with. Just go go go. Of course, their tasks are different, which probably influences their language.

Like I said, I think I'm alone in this view :(

I honestly can not believe that we still have to tell a compiler whether our variable is a string or int!

I'm going to check out C# and see how I get on.

You're going to love C# if those are the things you want.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Fruit Smoothies posted:

If you're not being sarcastic...

Follow the Coding Horrors thread. PHP is often featured as a horror in and of itself.

raminasi
Jan 25, 2005

a last drink with no ice

Fruit Smoothies posted:

So I downloaded Visual C++ 2010 Express because I've mostly programmed in PHP and Javascript these last years. The only really static, compiled work I ever did was in Borland Delphi.

I'm beginning to think that Visual C++ was a horrific choice. All the C++ tutorials I can find relate to the console-style C++ which makes a lot of sense. Apart from pointers and type casting, it's very similar to PHP, and I'm not struggling at all with it.

However, the visual side to it (IE: Managed C++ / .NET) seems to be so difficult to incorporate unmanaged code into.

Additionally, when I create an event handler, it sticks it in the header file for the form?! What? I thought the majority of app code went into cpp files?

This weirdness of code location confuses me. I'm trying to write a basic winsock client, which is simple enough in a console app. Now I wanna incorporate it into a more managed project for easier threading / class handling etc, but all the tutorials I can find seem to be for C++ rather than Visual Studio's mixture.

Should I give up and use QT? Or are there any good tutorials in Visual Studio C++, because I can't find them.

For reference, my client code is adapted from here

"Visual C++" is just what Microsoft calls its IDE for C++. It doesn't have to create GUI-based programs. You can create console applications with the correct project settings, but it sounds like you don't really want C++ anyway.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.

Fruit Smoothies posted:

If you're not being sarcastic...
Literally, you want a function, just create it. Anonymous functions. Want a string? Fine, make a string, none of this char array nonsense. You want an integer from a string? (int)$string. Done. Also, pointers?! In both PHP and JS, you parse a variable, and it assumes you're parsing the location of that data.

Want to loop? foreach() or for(var index in array) {}.

Even with pascal / delphi - which I knew pretty well, most of my time was spent converting various objects and data types (streams arghhh) to get things to work with other things.
With PHP / Javascript, most of my time is spent writing the logic. In fact, looking at PHP / javascript, the logic is often a lot easier to see than looking at stricter languages, even like pascal. With the web languages, you don't have endless conversions, pointers and data types to work with. Just go go go. Of course, their tasks are different, which probably influences their language.

Like I said, I think I'm alone in this view :(

I honestly can not believe that we still have to tell a compiler whether our variable is a string or int!

I'm going to check out C# and see how I get on.

C# can do just about everything on your list with the exception of maybe* (int)$string. It has anonymous methods/classes, foreach iterators, a distinct lack of pointers outside of special cases like COM/Win32 interop, no header files, strings as a native primitive type, and the keyword 'var' that tells the compiler to figure out the type if you don't care to specify it.

Basically C# was designed to let you concentrate on the logic of your own problem instead of fiddling around with low-level specifics. It's more strict than PHP, but in an appropriate way that keeps you out of trouble.



* I say maybe because I'm not sure what (int)$string means in your case. If you mean 'parse $string into it's integer equivalent' then int i = int.Parse(someString) would do want you want it to. If you mean 'interpret the bits in $string as if they were an integer and cast then you'd have to write your own extension method for the string class since there's many different ways to interpret that.

Fruit Smoothies
Mar 28, 2004

The bat with a ZING

PDP-1 posted:

* I say maybe because I'm not sure what (int)$string means in your case. If you mean 'parse $string into it's integer equivalent' then int i = int.Parse(someString) would do want you want it to. If you mean 'interpret the bits in $string as if they were an integer and cast then you'd have to write your own extension method for the string class since there's many different ways to interpret that.

(int)$string was a simple example. I have to use parseInt() in Javascript so I'm OK with that. I'm downloading V Studio Express now to gently caress around with.
It sounds promising. Concentrating on the logic is one of the main reasons I love PHP and Javascript, despite their limitations / faults.

ToxicFrog
Apr 26, 2008


Fruit Smoothies posted:

If you're not being sarcastic...

[list of basic HLL features snipped]

Like I said, I think I'm alone in this view :(

All the stuff you like about PHP is a standard feature of any modern high-level language. This doesn't really sound like you like PHP and JavaScript, so much as that you like high-level programming and PHP and JS are the only HLLs you've used so far. And that is a view you are definitely not alone in.

That said, PHP is a pretty poo poo language all around. Check out C#, Python, Scala, Lua, perhaps Scheme/Clojure, Haskell, Go, and F# once you want to get a bit funkier. The reason PHP gets constantly shat on here is that most of the people making GBS threads on it have used some of these languages, and know you can have a high-level language without a terribly written interpreter and inconsistent and insecure standard library - and that there are more options than "procedural, statically typed, low-level" and "object-oriented, dynamically typed, high-level".

quote:

I honestly can not believe that we still have to tell a compiler whether our variable is a string or int!

Any modern statically typed language will have a type-inferring compiler that can automatically determine the types of your variables based on their usage. :3:

shrughes
Oct 11, 2008

(call/cc call/cc)

ToxicFrog posted:

Any modern statically typed language will have a type-inferring compiler that can automatically determine the types of your variables based on their usage. :3:

And we write out our type names anyway, because even if we don't have to tell Mr. Compiler, we still have to tell other developers.

nielsm
Jun 1, 2009



shrughes posted:

And we write out our type names anyway, because even if we don't have to tell Mr. Compiler, we still have to tell other developers.

And even then I like my compiler yelling at me, sometimes: "You meant that to be an int? Yeah well it obviously ain't, so fix your poo poo. (Then thank me, cuz' I just saved you a headache debugging.)"

Look Around You
Jan 19, 2009

Fruit Smoothies posted:

If you're not being sarcastic...
Literally, you want a function, just create it. Anonymous functions. Want a string? Fine, make a string, none of this char array nonsense. You want an integer from a string? (int)$string. Done. Also, pointers?! In both PHP and JS, you parse a variable, and it assumes you're parsing the location of that data.

Want to loop? foreach() or for(var index in array) {}.

Even with pascal / delphi - which I knew pretty well, most of my time was spent converting various objects and data types (streams arghhh) to get things to work with other things.
With PHP / Javascript, most of my time is spent writing the logic. In fact, looking at PHP / javascript, the logic is often a lot easier to see than looking at stricter languages, even like pascal. With the web languages, you don't have endless conversions, pointers and data types to work with. Just go go go. Of course, their tasks are different, which probably influences their language.

Like I said, I think I'm alone in this view :(

I honestly can not believe that we still have to tell a compiler whether our variable is a string or int!

I'm going to check out C# and see how I get on.

Pretty much any modern high level language will give you all of that and more, in a more consistant, secure, sane package:

Python (thread) is an awesome dynamically typed, interpreted programming language with strong support built in for lists, tuples and dictionaries (key:value data structure), as well as a good class-based object system with multiple inheritance. It's got a really clean, readable syntax too.

Lua is another dynamically typed language that is essentially interpreted (it can be precompiled to C code though). It works extremely well interfacing with C code and is pretty fun to use. It's also got first class functions, anonymous functions, and it's table data structure should be somewhat familiar as it works sort of like a beefed up PHP array. Lua doesn't provide explicit OOP, but it provides all of the tools with metatables and the tbl:fn() notation which implicitly passes the table to the function's first argument as a "self" variable. OOP in Lua is also prototype-based, like Javascript.

Go (thread) is a newer "mid" level language that just had it's first major stable release. It was designed by Ken Thompson and Rob Pike among others. It's got static typing with a pretty good type inference system, first class and anonymous functions, and lightweight interfaces that don't need to be declared to be implemented. It's also got slices, which are really awesome as a replacement for pointers in C. It's got a good concurrency model with lightweight threads/coroutines that they call "goroutines", and a built in channel datatype that allows for efficient, safe information sharing between goroutines.

Scala (thread) is a statically typed, compiled multiparadigm language that runs on the JVM. It's got good type inference with a strong type system (this isn't a bad thing!), and has a strong functional bias with standard OOP still available. It also has first class and anonymous functions, and immutable values for safer functional programming.

Haskell is a slightly more esoteric modern language, which is a really awesome compiled purely functional language. It has an amazing type system, and has really good referential transparency. There's no variables in it, everything is a value. I/O isn't even done by directly changing variables, instead you use monads to represent it. You can also use them to represent state, among other things. Looping is done by recursion in Haskell. Functional programming is really awesome and even if you never use Haskell in a work environment it's still a fun language to learn.


Also I just realized that we don't actually have a Haskell thread... does someone want to make one since I made the lisp thread? If not I'll get on it later tonight or tomorrow.

-Anders
Feb 1, 2007

Denmark. Wait, what?
What, no love for Objective-C? :v:

shrughes
Oct 11, 2008

(call/cc call/cc)
Now's my chance to be a negative nancy. And sometimes a positive pansy.

Look Around You posted:

Python (thread) is an awesome dynamically typed, interpreted programming language with strong support built in for lists, tuples and dictionaries (key:value data structure), as well as a good class-based object system with multiple inheritance. It's got a really clean, readable syntax too.

Python has disturbingly weird scoping rules, is really slow, and is especially bad at multithreading, and is too verbose for shell scripting.

quote:

Lua is another dynamically typed language that is essentially interpreted (it can be precompiled to C code though). It works extremely well interfacing with C code and is pretty fun to use. It's also got first class functions, anonymous functions, and it's table data structure should be somewhat familiar as it works sort of like a beefed up PHP array. Lua doesn't provide explicit OOP, but it provides all of the tools with metatables and the tbl:fn() notation which implicitly passes the table to the function's first argument as a "self" variable. OOP in Lua is also prototype-based, like Javascript.

Also it has a very small runtime, which is very non-annoying to embed, especially in a multithreaded C/C++ application. (Compare this to the horrible javascript engines.)

quote:

Go (thread) is a newer "mid" level language that just had it's first major stable release. It was designed by Ken Thompson and Rob Pike among others. It's got static typing with a pretty good type inference system, first class and anonymous functions, and lightweight interfaces that don't need to be declared to be implemented. It's also got slices, which are really awesome as a replacement for pointers in C. It's got a good concurrency model with lightweight threads/coroutines that they call "goroutines", and a built in channel datatype that allows for efficient, safe information sharing between goroutines.

Go's "goroutines" are not special, userland m:n threading already exists in a bunch of languages. It's very elegant compared to C or C++, not elegant at all considering that it's a garbage collected memory-safe programming language with a C-like type system. It has a bad garbage collector. If I were to choose one language for doing some systems programming that wasn't performance sensitive enough to need to avoid garbage collection, Go would be a contender. Its type system is weak, though, you can't define your own generic data structures, which would be useful. The designers are too blind to the benefits of C++, or maybe just conservative.

quote:

Scala (thread) is a statically typed, compiled multiparadigm language that runs on the JVM. It's got good type inference with a strong type system (this isn't a bad thing!), and has a strong functional bias with standard OOP still available. It also has first class and anonymous functions, and immutable values for safer functional programming.

It's the only statically typed language that runs on the JVM that doesn't completely suck. It's actually the most advanced type system in any practicality-oriented language right now. It also has slow compiles and a lot of whiners. Generally speaking it's useful, despite the option of writing sane Java. If Java was as expressive as C++98 there would not be much reason for Scala.

quote:

Haskell is a slightly more esoteric modern language, which is a really awesome compiled purely functional language. It has an amazing type system, and has really good referential transparency. There's no variables in it, everything is a value. I/O isn't even done by directly changing variables, instead you use monads to represent it. You can also use them to represent state, among other things. Looping is done by recursion in Haskell. Functional programming is really awesome and even if you never use Haskell in a work environment it's still a fun language to learn.

Haskell's a great language that'll make you smarter, an infuriating language if you want to get performance out of it for big programs. You see people writing Haskell web frameworks and on certain benchmarks the process doesn't finish because the server went into swap. This is because it's lazily evaluated, and that's a bad thing. Looping is usually done using combinators. The compiler has been known to make optimizations that affects the big-O performance of your code positively or negatively. The community is a bunch of navel-gazing category theorists, plus several cool people.

A big problem with functional programming is the code is less editable than C-style languages. You can't just add a debug statement, or walk through your code in any intelligible order, or add a feature or change something without reindenting everything manually or having to thread a new variable through to a bunch of different functions.

quote:

Also I just realized that we don't actually have a Haskell thread... does someone want to make one since I made the lisp thread? If not I'll get on it later tonight or tomorrow.

We had a Haskell thread once.

The Gripper
Sep 14, 2004
i am winner

shrughes posted:

Go's "goroutines" are not special, userland m:n threading already exists in a bunch of languages. It's very elegant compared to C or C++, not elegant at all considering that it's a garbage collected memory-safe programming language with a C-like type system. It has a bad garbage collector. If I were to choose one language for doing some systems programming that wasn't performance sensitive enough to need to avoid garbage collection, Go would be a contender. Its type system is weak, though, you can't define your own generic data structures, which would be useful. The designers are too blind to the benefits of C++, or maybe just conservative.
I like go, but I agree with a lot of this (although the "there are better alternatives" argument applies to almost every language in some way or other, and people generally don't know every language to be able to pick and choose from).

There's features that could be implemented that aren't because the designers believe it will lead to confusing user code, so an observer would need to dig deep into to it to understand. Function/operator overloading are the two things I most miss having, as without them custom types such as big.Int are clumsy to work with in numerous ways. To compound the problem the developers seem intent on not adding endless methods to classes - which is good I guess - but it means there are no big.Int methods to add ints or int64s to an existing big.Int, just the Add method that takes big.Ints as arguments. Doing any math with types like this makes it a necessity to convert everything 1) from source type to int64 (as new big.Ints can only be created empty or from int64 or string) 2) from int64 to big.Int 3) finally, whatever math is required can be performed.

An optimal accumulator in go using a big.Int (emulating x++) looks like:
code:

x := new(big.Int)
x.SetString("999999999999",10) //set initial value of accumulator
k := big.NewInt(int64(1))
for y := 1;y<1000000;y++ {
    x.Add(x,k) //x++
}

as opposed to (with operator/function overloading):
code:
x := big.NewInt("999999999999",10) //base 10
for y := 1; y<1000000;y++ {
        x++; //or even x := x + 1
}
Sure, an observer would need to look into the big.Int implementation to know how "+" is overloaded, but so what? A lot of peeves like this seem to be disregarded because the main implementation/use of them in the standard library don't suffer from it; for big.Int it's mostly used in crypto libraries which require big integers but do very few <actual> calculations with them (or only do calculations involving big integers and nothing smaller). Edit; I'm not entirely sure but I think operator overloading would improve the performance of big.Int math with small values, since it has a natural number implementation that doesn't require creation of new big.Ints at all (but is not exported, so not usable by end-users currently).

I'll end by saying it's not a bad language to use, and what it supports works great, but it is irritating as hell if your usage falls outside the developers vision.

shrughes posted:

It's the only statically typed language that runs on the JVM that doesn't completely suck. It's actually the most advanced type system in any practicality-oriented language right now. It also has slow compiles and a lot of whiners. Generally speaking it's useful, despite the option of writing sane Java. If Java was as expressive as C++98 there would not be much reason for Scala.
Scala is a great language and something I'd recommend anyone looking for a functional/imperative mix language to at least give it a look, but yeah the compile times are awful and unfortunately it's being treated as one of those languages where you need to use a framework to actually get the most out of it.

The Gripper fucked around with this message at 12:11 on Apr 2, 2012

Adbot
ADBOT LOVES YOU

Computer viking
May 30, 2011
Now with less breakage.

shrughes posted:

Python has disturbingly weird scoping rules, is really slow, and is especially bad at multithreading, and is too verbose for shell scripting.

It's a really nice "get poo poo done"-language, for those problems that require a bit more than a compact shellscript but a bit less than an application. (I just used it to do some array-of-heatmaps-with-other-junk-hung-on-the-side visualization for work). It's a useful niche, but not an end-all/be-all. :)

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply