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
TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

rotor posted:

has anyone ever written forth? it seems so neat.
forth is great for embedded systems, but it's kinda difficult to write maintainable programs in it because they trend towards being super-short and cryptic. you have to be the kind of person who enjoys busting out a whiteboard to diagram a line containing fourty single characters.

there's a guy I know who writes these little five-line forth programs to draw roses or bridges or such, they're cool.

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Police Academy III posted:

that's my whole point! arrays are not tables, they should have semantics specific to arrays, like index bounds. assembly lets you use a machine word as an int or a memory address or a float or an instruction, but most of the time that's not a good idea and you want assurance that something that is intended to be used in a certain way will be used in that way.
lua doesn't have arrays. it has tables.

if you want to complain that it *should* have arrays, that's fine, but stop pretending to be offended because the lua implementers decided your pet feature wasn't necessary to the language.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Police Academy III posted:

frig off janin, a proper array datatype is hardly an obscure feature request
obscure or not, they're not necessary. arrays are only useful if you're going to be doing some sort of performance-sensitive computation. lua is explicitly designed to be a glue language, so there's no point in having features like arrays.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Police Academy III posted:

it's not about performance, i don't care if they implement arrays with a loving bloom filter. it's about ensuring that data that is supposed to be used in a certain way is actually being used in that way. the single most common type of datastructure in all programming is "numbered list of stuff", in lua you have no guarantee that a numbered list of stuff will remain a numbered list of stuff.
So go write an array type yourself. Or use someone else's -- if they're as useful as you claim, someone else will already have written one.

ahhh spiders posted:

arrays are just a specialization of tables, which happen to be in lua already
Arrays are not a specialisation of tables, any more than integers are a specialisation of strings (shut up TBC)

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

ahhh spiders posted:

they're tables with a contiguous and totally ordered keyset
no; an array is a contiguous memory allocation with fixed-size homogeneous elements.

it's true that an array can be losslessly converted to a table and back, but that's not the same as saying that arrays are a type of table.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Char posted:

if you use haskell for production builds you're missing the entire point of haskell
what else would you use haskell for?

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Char posted:

this is a trick question right
no, I'm serious.

between its strong type system, good performance, and easy C binding system, it's practically ideal for writing reliable production services.

I can't really think of what else you'd use it for; static typing is annoying for small scripts, and Haskell binaries are too large to use in embedded systems.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

ppp posted:

i thought validated languages were a solved problem with ada
you can write validated code in any language; advanced features like those in haskell's type system just make it easier.

yaoi prophet posted:

qft, if you link hxt which is one of the heavy-duty xml processing libraries you get like 30 extra megs on your binary, 20 if you strip it
ugh, fuckin' hxt. I had to remove it from all my library dependencies because it was just too big and had too many dependencies.

why yes, I would like to install three hundred megs of dependencies to parse a 1kB xml document!!!

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Internaut! posted:

speaking of haskell janin how painless is C and C++ interop, I've taken this little clojure side project as far as it can go and it's been fun but it's not like I actually planned to suggest dropping a JVM bollock into our core trade switching punchbowl
Bindings to C++ are painful. Since there's no standard ABI, you basically have to wrap all of the C++ bits in C functions.

Bindings to old-fashioned C can be a *little* iffy if your library's interface uses language features that don't have a direct Haskell equivalent, such as static global initialisation. These are widely regarded as poor design, so they aren't common, but if you're writing a binding to a library written in the '80s then you're in for some adventure.

Bindings to modern C are trivially easy, there are tools that will parse C header files and generate all the stubs for you. Runtime overhead is low since calling a foreign function is literally just a standard C procedure call. Basically you just say "here's a header, here's the function I want" and then you compile and you've got a usable binding.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

MononcQc posted:

It just sucks that some things like 'forall' for types ends up being overloaded depending on what compiler extension is plugged in.
Not sure what you mean here; keyword "forall" is (as far as I know) only used by the Rank2Types/RankNTypes, and ExistentialQuantification extensions. Sure, it's the same keyword, but the context makes it pretty obvious as to how it's being used, and the semantics are pretty similar either way.

I try to avoid all the scary-named extensions so maybe there's some out there that do additional weird stuff with it, idk.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

yaoi prophet posted:

wait how do you generate the foreign import declarations from header files
start with a C source and header file

code:
/* yospos.h */
void yospos_bitch(const char *msg);

/* yospos.c */
#include <stdio.h>
void yospos_bitch(const char *msg) {
    printf("%s; yospos, bitch\n");
}
then you write a haskell file with some c2hs statements, and give it the .chs extension so Cabal will preprocess it automatically

code:
-- hs-yospos.chs
{-# LANGUAGE ForeignFunctionInterface #-}
import Foreign
import Foreign.C

#include "yospos.h"

yosposBitch :: String -> IO ()
yosposBitch msg = withCString msg {# call yospos_bitch #}

main = yosposBitch "haskell owns"
then build and run:

code:
$ gcc -c yospos.c
$ c2hs hs-yospos.chs 
$ ghc --make -o yospos hs-yospos.hs yospos.o
[1 of 1] Compiling Main             ( hs-yospos.hs, hs-yospos.o )
Linking yospos ...
$ ./yospos 
haskell owns; yospos, bitch

TOO SCSI FOR MY CAT fucked around with this message at 04:19 on May 12, 2012

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

yaoi prophet posted:

the one feature i really wish haskell had was the ability to say 'ok what type does x have to be for this to typecheck', you can do it manually via implicits (which is the only time i've ever seen anybody use implicits) but having something like agda's holes would be gr8
I don't understand what this means, or how implicit parameters would support it. Could you give an example?

Internaut! posted:

perfect, and how about the reverse? this code chunk I'm looking at has hundreds of C tests making direct function calls, if there's an easy way I can adapt/reuse those tests then that would both save a lot of time and make the approach easier to sell up
I don't think there's any tool that will generate export declarations for you, sorry; you'll have to write them out by hand (though you could use c2hs to do typechecking, if you use either CPP or TH).

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

rotor posted:

the unicorn doesn't work!

did you install all the gems??

crunchy bacon!! :xd:
this is why I cannot take ruby seriously

oh boy, an anime-themed language with libraries by people who think wearing sunglasses makes them a frat boy. sign me up!!

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Internaut! posted:

yeah I read the explanation but I don't buy it, it sounds like rationalization

like if you figured out a way to uhhhhhhh say defeat STL runtime type checking it might be a cool trick that's useful in some project and you could write a paper espousing the benefits and offering suggestions as to when it would be useful

but that doesn't mean it's a good idea in general
it's not defeating the type checking, it's just deferring the type errors to runtime.

imagine you had a c++ compiler which would take the following procedure:

code:
void Broken() {
  int a = 1;
  string b = "2" + a;
}
and when the type-checking failed, instead of emitting a compile-time error, it would emit a warning, and replace the generated assembly with the equivalent of:

code:
void Broken() {
  int a = 1;
  throw TypeError("no match for operator+(const char *, int) ...");
}
It's still compile-time static type checking.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Internaut! posted:

eh I understand how it works, to me a compiler that doesn't catch type errors in a statically typed language is broken but w/e

janin would you ever use this and why
it sounds really useful for IDEs. they could provide more useful code completion and analysis of partially-implemented functions and modules.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Markov Chain Chomp posted:

just ban both lovely trolls

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Ronald Raiden posted:

someone give me an idea for a cool (and maybe useful???) thing to do wiht haskell so I have a reason to mess around with haskell again tia
write a toy irc client/server, then a buttbot which runs in it

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

tef posted:

just use a haskell version of the tex hyphenation algorithm http://hackage.haskell.org/package/hyphenate
hoyl gently caress, that api

nice job, good idea representing an unbounded set as a constructor, that'll never be a problem

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Police Academy III posted:

one of my fav bits of useless trivia is that ANSI C specifies that a char is 1 byte, but doesn't say that a byte has to be 8 bits.
that's because back when C was created, there were popular systems that had 7-bit and 10-bit bytes.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Mr Dog posted:

It wouldn't have been hard to retrofit a non-retarded behaviour in Python 3, either, just add a has_next or __has_next__ or whatever method to the iterator protocol and then keep the existing StopIteration behaviour as a genuine "you did something you weren't supposed to do, bonehead" exception, albeit a poorly named one. Even a __boolean__ coercion, while kinda terrible, would have been better than just leaving that wtf in its current form.
It's not possible to implement a has_next() method on an iterator, because whether there is a next value cannot be determined until you try to calculate it.

A better solution would be to have next() return a wrapper with .value and .has_value attributes, but this would have broken backwards compatibility.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Dr. Honked posted:

surely you buffer poo poo like that?
Iterators are just functions, which means they can do anything (read from the network, spawn threads, call exit(), etc). You can't buffer them.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Shaggar posted:

you buffer the data that you are iterating over...
Here is an example iterator. How would you buffer it?

code:
import random, sys

def iter_and_maybe_die():
  while True:
    n = random.randint(0, 10)
    if n == 10:
      sys.exit()
    yield n

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

BonzoESC posted:

so what you're saying is that it works best if the enumeration loop knows what it's enumerating over, so you can have one version for arrays and other bounded collections and one for IO that reads until exhausted, but both present the same API to higher-level code so you don't have to care?
this is how python works, fyi

the api they're complaining about is the one for IO

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

BonzoESC posted:

nah they're at a lower level if they have to worry about exceptions from the array ending

or does python have some kind of __~^each^~__(array, lambda{but only one expression}) function with a terrible name and tenuous object-orientedness?
Python's compiler special-cases iteration over fixed-size sequences, so it uses a more efficient internal mechanism.

Iterators are for when you're looping over a value which doesn't have a fixed size, and might need to perform arbitrary IO to calculate the next element.

And why would you ever want a lambda with more than one expression? If you really need to use statements in a loop for some horrible reason, just define a local procedure.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
In Python, it's more idiomatic to use existing control structures like 'if' or 'with', rather than inventing your own ad-hoc.

code:
with context("a calculator") as c:
  with c.setup():
    calculator = Calculator()

  with c.should("add two numbers for the sum"):
    assert_equal(4, calculator.sum(2, 2))

  with c.should("multiply two numbers for the product"):
    assert_equal(10, calculator.product(2, 5))
If multi-line closures are really the best solution to some problem, then you're probably doing something complicated, and shouldn't mind naming your closures.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

iamthexander posted:

answer my question nerds
go to a local community college and take cs 101

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"
yes lets have everything go through loving disk io

zombywuf, you're even dumber in yospos then you are in coc. you're like tiny bug child, except even he can get by in at least one language.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

http://www.boost.org/doc/libs/1_46_1/libs/iostreams/doc/guide/pipelines.html

I know you have this really disturbing relationship with Haskell Janin, but the comment was about syntax and expressiveness, not data storage. Take a deep breath, relax, and consider that no-one was suggesting the replacement of Haskell with Bash.
ah, so the actual syntax for your example would be something like

code:
lolboost::pipeline_var tmp_b, tmp_c;
lolboohst::pipeline pipeline_1(one).push_back(two).tee(&tmp_b).push_back(three).redirect_stdout(&tmp_c);
lolboost::pipeline pipeline_2(four).arg(&tmp_b).arg(&tmp_c);
pipeline_1.run();
pipeline_2.run);
Yeah, that's so much easier to read.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

I wouldn't criticise other peoples ability to get by in multiple languages if I were you.
Then please, by all means, post the actual working C++ code that does the equivalent of that haskell and/or bash.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

C++ code:
try {
  auto b = two(one(a));
  auto d = four(b, three(b));
} catch (...) {
}
This is completely different, good job being mutually incompetent in three languages I guess.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Ridgely_Fan posted:

well the spec was written in haskell and no non-spergs can read that
it's not hard to read, zombywuf is just dumb as gently caress, and keeps the goalposts mounted on a backpack for maximum mobility.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

ZShakespeare posted:

For one of my final projects before I get my degree I have to learn a "weird" language and do a big report that compares and blah blah blah with examples. The suggested languages are Clojure, Erlang, Go, Groovy, and Scala. I can ask for approval to do any language though as long as it's an actually language so no HLA or forth or some poo poo like that.

what is the most YOSPOS language?
none of those languages are "weird" unless your professor only knows java and c#

why aren't you allowed to use forth? it's got a language spec, several mostly-compatible implementations, and lots of libraries.

Another unusual language is J http://www.jsoftware.com/

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Condiv posted:

so, I have to wonder if there's a language that is anywhere near as binary incompatible with itself as Scala is.
Haskell

Object code and shared libraries built from Haskell source have their ABI version set to essentially SHA1(signatures of all public and private declarations from entire dependency tree). Dynamic linking is implemented in the compiler but is essentially worthless, because even the most minor change to a library causes the ABI to change and all executables to refuse to load the new .so file.

Adbot
ADBOT LOVES YOU

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

MononcQc posted:

Again, I haven't ever programmed go, so my opinion isn't worth much on it.
I work for Google, have written at least 10k lines of Go, and my conclusion is that it's nothing less or more than what C++ should have been.

If you go into it expecting C with more reasonable syntax and an immature compiler, plus some basic threading primitives, you'll be happy. It's a decent replacement for Python in cases where eval() isn't needed, and not quite as mind-numbingly verbose as Java. The interface concept is nice.

But make no mistake, it's a very very conservative language. Writing in Go feels like stepping through a wormhole into the '80s. There's no real type inference[1], no type parameters, no re-exporting imported symbols, no typed enums, and no encapsulation (!!) except at the file/package level. It's obvious that the core developers think C89 was the absolute pinnacle of language design.

[1] Variable assignments use the equivalent of C++'s "auto" keyword.

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