Many of the changes you are suggesting were intentional design
choices, because the alternative would lead the user to introduce
subtle design flaws into their code. these small tweaks to the syntax,
forcing the user to clarify their intent, resulted in better user code
- if 5: should work (ala python and c, and not the redundant "if 5>0")
> these aren't even equivalent in python / c, where the if statement
should read `if 5!=0`. this was changed in julia for better
readability and few surprises and after a long trial period (2 years?)
it was deemed to result in better code to require boolean conditions
This would be inline with the Julia one-based indexing. (Maybe an
idea is to use braces for zero based indexing, e.g. a{0}=3.14)
> this syntax is already taken
- dictionary: mydict = ["one": 1, "two": 2, "three": 3]
(i.e. colons ala pythons instead of ["one"=> 1, "two"=> 2, "three"=>
3], shorter and cleaner)
well, it is ambiguous: [1:3]
> this syntax is also already taken (as you mentioned)
- end statement: remove it (ala python) and use indentation, the code
will be shorter and cleaner
> nicely indented code is both a plus and minus in python. i like
that it's very readable, but it does make using the interactive repl
much harder.
- case/switch: include it (missing in python)
> this feature will probably be included in some future release,
when someone gets time to implement it (same for enum and divmod). if
you want to join the discussion for these features look them up on
github. often these are not implemented because of unresolved
discussions about what features/syntax they should support
On Thu, Apr 3, 2014 at 9:45 PM, Leah Hanson <[email protected]> wrote:
> Friedrich,
>
> Sorry if I sounded like I wasn't taking your suggestions seriously; I just
> meant that some of them have been discussed seriously and at length already
> (on this list, and on github issues linked by those discussions). It might
> be helpful to you to see the perspectives already expressed there on these
> same issues. Despite its youth, Julia's syntax is stable; breaking syntax
> changes would require a very strong argument.
>
> I know that `if 5` works in Python and in C. Many languages choose to make
> `0` ¨truthy¨ and all other values ¨falsey¨, meaning that they are used as
> true/false despite not being booleans. It is by design that this doesn't
> work in Julia.
>
> -- Leah
>
> On Thu, Apr 3, 2014 at 7:43 PM, <[email protected]> wrote:
>>
>> Dear Jake,
>>
>> Thanks, I didn't know. However, they are not fully equivalent:
>>
>> julia> divrem(-7.5, 4)
>> (-1.0, -3.5)
>>
>> >>> divmod(-7.5, 4)
>> (-2.0, 0.5)
>>
>> When I need it, I usally need the latter version.
>> So still a divmod could be implemented.
>>
>> Friedrich
>>
>> Am Freitag, 4. April 2014 01:48:59 UTC+2 schrieb Jake Bolewski:
>>>
>>> divmod in python is divrem in Julia.
>>>
>>> Best,
>>> Jake
>>>
>>> On Thursday, April 3, 2014 6:45:37 PM UTC-4, [email protected]
>>> wrote:
>>>>
>>>> Hi Julia users,
>>>>
>>>> Maybe you want to support me with my wish list.
>>>> Here it is:
>>>>
>>>> - end statement: remove it (ala python) and use indentation, the code
>>>> will be shorter and cleaner
>>>>
>>>> - case/switch: include it (missing in python)
>>>>
>>>> - array indexing: introduce with negative number -1,-2,... (instead of
>>>> or additionally to end, end-1)
>>>> e.g.: a[-3:-1] vs a[end-2:end]
>>>> (again shorter and cleaner). Note -1 could index the last element (not
>>>> previous last element as in python)
>>>> This would be inline with the Julia one-based indexing. (Maybe an idea
>>>> is to use braces for zero based indexing, e.g. a{0}=3.14)
>>>>
>>>> - dictionary: mydict = ["one": 1, "two": 2, "three": 3]
>>>> (i.e. colons ala pythons instead of ["one"=> 1, "two"=> 2, "three"=>
>>>> 3], shorter and cleaner)
>>>> well, it is ambiguous: [1:3]
>>>>
>>>> - provide a divmod function ala python
>>>>
>>>> - if 5: should work (ala python and c, and not the redundant "if 5>0")
>>>>
>>>> - provide an enum function (enumerate ala python)
>>>>
>>>>
>>>> - [1 2 3] .< 2 remove the dot in those scalar operations
>>>>
>>>> - elseif => elif
>>>>
>>>>
>>>>
>>>>
>>>> - length => len
>>>>
>>>>
>>>> Ok. That's it for now.
>>>> Julia devs, you did a great job! There are many things that I like more
>>>> than in python.
>>>>
>>>> Cheers
>>>> Friedrich
>>>>
>>>>
>>>>
>>>>
>