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
PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

tef posted:

3. strings *almost* behave like lists, implying array like access (untrue),

5. i'd rather have let than global. (i'd rather have dynamically scoped variables than global singletons in modules, for things like stdin, stdout, et al.)

curious about what you'd prefer for these two. for (1), java-style getChar()? for (2)... honestly I'd need to see an example.

(agreed with the others at least.)

yaoi prophet posted:

what languages are these

second one is python

Adbot
ADBOT LOVES YOU

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Malcolm XML posted:

also (paging tef) whats a good intro to prolog/logic programming book

I wanna write me a logic dsl in haskell like miniKanren or something, that would be cool

not tef but:
http://www.amazon.com/dp/0321417461/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&colid=M55D5Z0NCMZY&coliid=IA5PYLPRXEE1M
and
http://www.amazon.com/Art-Prolog-Ad...s=art+of+prolog
are both recommended

the second one "Art of Prolog", make sure you get a recent version. the version i have has shitloads of errata in it.

tef
May 30, 2004

-> some l-system crap ->

yaoi prophet posted:

what languages are these

first is ruby.

1. ruby only has require. there is no namespaces, only classes. coming from python where import foo means 'import foo.py in the search path, and bind it to foo locally', to 'require foo' meaning 'run all of this script in the same environment', it's a bit filthy.
2. the defacto standard library is activesupport. everyone ends up including it, if only to ensure that it won't break when someone else does it.
3. ruby has a shitton of "dsls" written using ruby syntax, but overloading the language semantics. last check on number of languages in rails was 12 or so.
4. if you use require, it can define any class or method, or redefine any class or method. class names and package names can be different too.
5. ruby has strings with an optional encoding, and when you concat them, it uses magic rules to make it usually work except when it doesn't

second is python.

PleasingFungus posted:

curious about what you'd prefer for these two. for (1), java-style getChar()? for (2)... honestly I'd need to see an example.

i reckon we should treat strings as mostly opaque blobs, not as arrays or lists, and expose iterators, rather than an lookup by index.

strings in python don't behave or perform in the same way as lists do. it's just a bad hack from the ascii age.

- as mentioned, getchar is always going to have to a full scan if it's using utf-8, or utf-16 internally, so treating it like an index into an array is broken. so strings don't have the same performance characteristics as arrays.

- python currently treats strings as sequences, which return strings. so "foo"[0] is the string "f", "foo"[0][0] is also the string "f" too. what should be getting an character instead is returning a substring. it's as if it would be ok for [1,2,3][0] to return [1].

- if you put a string into something that handles lists, something will break subtly, often hitting the recursion limit. this means people end up littering code with isinstance checks to say 'hold up, is this a real list or a string'.

some weird things can happen in python when you assume strings are just lists of characters too, like reversing a string:

code:
>>> print foo
über
>>> print "".join(reversed(foo))
reb̈u
>>> 
(that should say reb̈u)


instead of pretending strings are lists, when they don't perform or behave like lists, you can use methods to convert a string into a list, or a generator. i.e, strings could have methods like .codepoints(), .chars(), .words(), or .lines(), rather than the lovely world of a for loop, explicit counter, and getChar.

making the list conversion explicit can handle some of the unicode issues for you. the above example could be "".join(reversed(foo.chars()), and not be as broken. you could even have named parameters for some of the edge cases.

and that's still with some underlying assumptions about language (ha! words! ha!). and we haven't even begun to talk about string normalization yet.

tef fucked around with this message at 19:17 on Oct 9, 2013

power botton
Nov 2, 2011

i bought the art of prolog its pretty good but doesn't gently caress around and dives into things really quickly

Socracheese
Oct 20, 2008

i have a dumb programming question. has anyone messed with neural network things before?

why are people using linked hardware to try to simulate, why cant u just abstract the neurons with C++ objects or something on one computer with a shitton of ram

tef
May 30, 2004

-> some l-system crap ->

Malcolm XML posted:

also (paging tef) whats a good intro to prolog/logic programming book

I wanna write me a logic dsl in haskell like miniKanren or something, that would be cool

art of prolog is a great book, but it's quite big, but wonderfully through. if you're wanting a taste, i would imagine the reasoned schemer might be more interesting, as I believe it's the source of miniKanren

tef
May 30, 2004

-> some l-system crap ->
oh it seem i can't post broken unicode reb̈u in a code block

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

tef posted:

1. ruby only has require. there is no namespaces, only classes. coming from python where import foo means 'import foo.py in the search path, and bind it to foo locally', to 'require foo' meaning 'run all of this script in the same environment', it's a bit filthy.

this sounds like how php does it, which so far i definitely prefer to python style modules. what are you supposed to do when you want to screw with the global namespace from within a "module"?

tef posted:

- as mentioned, getchar is always going to have to a full scan if it's using utf-8, or utf-16 internally, so treating it like an index into an array is broken. so strings don't have the same performance characteristics as arrays.

this does not really sound like an argument against treating strings as a list, it sounds like an argument against using weird encodings. the natural definition of a string is a sequence of characters. if you can't tell what character is at a given index just by doing a simple multiplication operation your encoding is bad and dumb

tef posted:

- python currently treats strings as sequences, which return strings. so "foo"[0] is the string "f", "foo"[0][0] is also the string "f" too. what should be getting an character instead is returning a substring. it's as if it would be ok for [1,2,3][0] to return [1].

this is definitely correct as working. strings subdivide into strings, and a character is just a string of length 1. any distinction between a character and a string is just a silly artifact of the underlying implementation. that analogy doesn't work because the 0th element of [1,2,3] isn't [1], it's 1, but the 0th element of "foo" is "f".

tef posted:

some weird things can happen in python when you assume strings are just lists of characters too, like reversing a string:

code:
>>> print foo
über
>>> print "".join(reversed(foo))
reb̈u
>>> 

that looks like it did exactly what it was supposed to: reverse the order of the characters in the string. the actual problem here is that string is something weird and nonstandard instead of [0x97, 0x62, 0x65, 0x72]

MononcQc
May 29, 2007

Socracheese posted:

i have a dumb programming question. has anyone messed with neural network things before?

why are people using linked hardware to try to simulate, why cant u just abstract the neurons with C++ objects or something on one computer with a shitton of ram

Handbook of Neuroevolution Through Erlang :getin:

I bought it but have read only like 1/10 of it so far

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

tef posted:

art of prolog is a great book, but it's quite big, but wonderfully through. if you're wanting a taste, i would imagine the reasoned schemer might be more interesting, as I believe it's the source of miniKanren

you can also get william byrd's ph.d. dissertation:
https://scholarworks.iu.edu/dspace/bitstream/handle/2022/8777/Byrd_indiana_0093A_10344.pdf

and cause i'm a clojure fag, dissect the core.logic package:
https://github.com/clojure/core.logic

Opinion Haver
Apr 9, 2007

i love you php shaggar

PleasingFungus
Oct 10, 2012
idiot asshole bitch who should fuck off

I'd honestly never thought about the impact of unicode on string operation performance characteristics. (much less that reversed() example.) interesting.

it feels like a design decision that made (more) sense back in the python 1/2 days, before strings were unicode by default. now that they are... hm.

(the issues distinguishing between strings & lists isn't something that I've encountered myself, so I don't weight that quite as highly... but I do get that it can cause trouble. I remember you brought it up the last time we had this discussion.)

still curious about your point 5, dynamically scoped variables rather than singletons.

tef
May 30, 2004

-> some l-system crap ->

PleasingFungus posted:

I'd honestly never thought about the impact of unicode on string operation performance characteristics. (much less that reversed() example.) interesting.

it feels like a design decision that made (more) sense back in the python 1/2 days, before strings were unicode by default. now that they are... hm.

you have come to a world called unicode *whipcrack*

yep, unless you're a racist, you're gonna have to deal with those 'funny' characters.

quote:

(the issues distinguishing between strings & lists isn't something that I've encountered myself, so I don't weight that quite as highly... but I do get that it can cause trouble. I remember you brought it up the last time we had this discussion.)

this is a personal issue I have. for example, there are some apis where you want to say do foo(a="...") or foo(a=["aaa", "aaa"])
if this were say foo(a=1) foo(a=[1,2,3]), the usual python idiom would work: a for loop in a try/except.

other people avoid this by either having two different parameters, or always taking a list, so you have to do foo(a=["aaa"]). the problem is that if you mistakenly do foo(a="aaa"), it sees ["a","a","a"]. so defensive code has to put in explicit checks. when python shifted to unicode, many of these defensive checks did isinstance(..., str), and so broke on unicode. it's a sort of "when it quacks like a duck, looks like a duck, but it's not a duck" moment backfiring. because strings almost behave like lists, you have to introduce special case code, and this special case code makes the libraries harder to update in light of changes.



quote:

still curious about your point 5, dynamically scoped variables rather than singletons.

this is more of a wishlist, but for example, in python with threads, you can't override stdin/stdout per thread. you can't overwrite it without affecting something else. meanwhile, if it were say a global variable, which was dynamically scoped, it would be less of an issue. for ex, say you used %foo to mean 'global + dynamic', you could override things by doing foo(1,2,3, %stdin=.....) for the duration of that function call.

i kinda think that globals, like process wide state, should be overridable on the call stack, rather than only being able to be changed process wide, because it's nice for testing or changing things. this is more of a 'this would be nice and i think it would work out ok', but if you got rid of threading, then it's a moot point.

tef
May 30, 2004

-> some l-system crap ->

Tiny Bug Child posted:

this sounds like how php does it, which so far i definitely prefer to python style modules. what are you supposed to do when you want to screw with the global namespace from within a "module"?

code:
>>> __builtins__.butt =1
>>> butt
1
>>> 
:q:

quote:

this does not really sound like an argument against treating strings as a list, it sounds like an argument against using weird encodings.

i know but some of us aren't racist

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

ty i am still getting my python "bearings" so to speak. it is often a weird and unintuitive language but i guess that's the price you pay for speed.

tef posted:

i know but some of us aren't racist

look at this shameful race-baiting. there's nothing racist about it. unicode is bad; if you really need to use strange characters chances are they're in some *actual* code page; i mean i know for a fact there's at least 437 of them, so anything ppl actually use is going to be in there somewhere. and if you've run into a use case where that's necessary chances are you already know you're making a page for eastern moldavia or whatever so you can just go ahead and use the proper one

tef
May 30, 2004

-> some l-system crap ->
💩

Bloody
Mar 3, 2013

Tiny Bug Child posted:

ty i am still getting my python "bearings" so to speak. it is often a weird and unintuitive language but i guess that's the price you pay for speed.

wot

X-BUM-RAIDER-X
May 7, 2008

Tiny Bug Child posted:

you already know you're making a page for eastern moldavia or whatever so you can just go ahead and use the proper one

or skip the website entirely because noone in Moldova owns a computer let alone has internet access

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

OBAMA BIN LinkedIn posted:

or skip the website entirely because noone in Moldova owns a computer let alone has internet access

whoa watch out comrade or the hyper PC squad will run you in for thinkcrime

b0lt
Apr 29, 2005

shrughes posted:

C++:

1. integers can silently overflow
2. pointers and pointer-like things can be null/empty, because it has std::move and rvalue references instead of real linear types
3. defaults to mutable instead of const
4. heinous amounts of syntax for things that should be simple like declaring a reasonably safe abstract class. no algebraic datatypes / pattern matching.
5. almost every library outside the STL is a horrible uninteroperable pile of poo poo

6. single argument constructors aren't explicit by default
7. interaction between implicit conversion, ADL, and templates is basically a giant mystery box
8. std::future isn't composable
9. they forgot to add std::make_unique
10. std::vector<bool>

Deus Rex
Mar 5, 2005

refinements (which allows you to monkeypatch a module without "exporting" those monkeypatches) are coming in mri 2.1 but the last time they were candidates for inclusion they had hilarious performance implications. maybe this was somehow addressed

also i watched a simon peyton-jones talk about lenses in haskell and i think i might "get" them now. and it makes me feel like less of an idiot that SPJ also tends to writes haskell in pointful style :unsmith:

http://skillsmatter.com/podcast/scala/lenses-compositional-data-access-and-manipulation

MononcQc
May 29, 2007

New JSON standard is out.
They still went with the railroad diagrams. I hoped they'd at least specify that object names need to be unique
and if there are duplicates whether you drop them, accept the first one or the last one, or deny all input. This poo poo is still unspecified and implementation-dependent.

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror

MononcQc posted:

New JSON standard is out.
They still went with the railroad diagrams. I hoped they'd at least specify that object names need to be unique
and if there are duplicates whether you drop them, accept the first one or the last one, or deny all input. This poo poo is still unspecified and implementation-dependent.

wtf is a "solidus character" and a "reverse solidus character". those are called slashes, ecma ppl

Deus Rex
Mar 5, 2005

MononcQc posted:

New JSON standard is out.
They still went with the railroad diagrams. I hoped they'd at least specify that object names need to be unique
and if there are duplicates whether you drop them, accept the first one or the last one, or deny all input. This poo poo is still unspecified and implementation-dependent.

has anyone pointed out that the standard is called ECMA-404

Notorious b.s.d.
Jan 25, 2003

by Reene

Tiny Bug Child posted:

ty i am still getting my python "bearings" so to speak. it is often a weird and unintuitive language but i guess that's the price you pay for speed.

hate to break it to you: python is one of the slowest languages ever

the weird and unintuitive stuff is there because Guido liked it that way, pretty much never for performance

Tiny Bug Child posted:

look at this shameful race-baiting. there's nothing racist about it. unicode is bad; if you really need to use strange characters chances are they're in some *actual* code page; i mean i know for a fact there's at least 437 of them, so anything ppl actually use is going to be in there somewhere. and if you've run into a use case where that's necessary chances are you already know you're making a page for eastern moldavia or whatever so you can just go ahead and use the proper one

using codepages and ascii variants is not so bad for european languages. the non-unicode options for CJK and other asian stuff are really, really bad.

also, without unicode, what do you do when you need to mix codepages in a string or document?

in either case, you will have tons of special case code for encoding quirks. i would rather just have special-case code for unicode quirks and handle all languages at once

Opinion Haver
Apr 9, 2007

Tiny Bug Child posted:

wtf is a "solidus character" and a "reverse solidus character". those are called slashes, ecma ppl

uh no slash is when you write fanfiction w/gay relationships. i'd know

Socracheese
Oct 20, 2008

MononcQc posted:

Handbook of Neuroevolution Through Erlang :getin:

I bought it but have read only like 1/10 of it so far

this looks p sw8, thx

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

MononcQc posted:

New JSON standard is out.
They still went with the railroad diagrams.

Is there ever a reason to use rr diagrams instead of bnf outside of a tutorial document?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
the ones in http://dev.w3.org/csswg/css-syntax/ are p. sweet

Bloody
Mar 3, 2013

MononcQc posted:

New JSON standard is out.
They still went with the railroad diagrams. I hoped they'd at least specify that object names need to be unique
and if there are duplicates whether you drop them, accept the first one or the last one, or deny all input. This poo poo is still unspecified and implementation-dependent.

cool 14 page """standard"""

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
three of those pages are empty

Posting Principle
Dec 10, 2011

by Ralp
should i actually make an effort to learn scala

Shaggar
Apr 26, 2006
no

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
someone posted this a couple pages back, it is hilarious and taught me as much about scala as i will ever need to know

quote:

As my team navigated these waters, they would occasionally ask things like: "So this one guy says the only way to do this is with a bijective map on a semi-algebra, whatever the hell that is, and this other guy says to use a library which doesn't have docs and didn't exist until last week and that he wrote. The first guy and the second guy seem to hate each other. What's the Scala way of sending an HTTP request to a server?"

X-BUM-RAIDER-X
May 7, 2008
yeah don't kid yourself into thinking you can actually do anything useful in a useless dead language

power botton
Nov 2, 2011

OBAMA BIN LinkedIn posted:

yeah don't kid yourself into thinking you can actually do anything useful in a useless dead language

like c++?

X-BUM-RAIDER-X
May 7, 2008
if you cannot program in c++ then you should not be programming anything

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

hahahahaha

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

OBAMA BIN LinkedIn posted:

if you cannot program in c then you should not be programming anything

ftfy, cmon be reasonable

Adbot
ADBOT LOVES YOU

Notorious b.s.d.
Jan 25, 2003

by Reene

OBAMA BIN LinkedIn posted:

if you cannot program in c++ then you should not be programming anything

no one can craft correct programs in c++

c++ devs imagine they can
the rest of us already know that's not true

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