Re: [ast-users] Regression in += operator
cc: orm...@gmail.com Subject: Re: Re: [ast-users] Regression in += operator It's intentional. It's valid to export this to a command's environment. It works in zsh, bash (git), and has worked previously at some point in ksh93. It worked in ksh93u but it was leaving side effects and this violated the standard. When I run this in bash, I get $ bash -c 'typeset -i x=1; x+=1 command eval echo \$x' 1 If I run $ ksh93u -c 'typeset -i x=1; x+=1 command eval echo \$x;echo $x' 2 2 which is not correct since regular command should not leave side effects in the current environment. I haven't yet decided how to resolved this. David Korn d...@research.att.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] _ doesn't refer to the correct object.
cc: orm...@gmail.com Subject: Re: [ast-users] _ doesn't refer to the correct object. In this type, I can't think of any way to refer to obj from within x.get. _ should point to obj in this context, not obj.x. #!/usr/bin/env ksh typeset -T Type=( typeset -h 'This will be a property.' x integer -h 'This will be the backing field for x.' y=5 function x.get { # Huge problem here because _ refers to x, # we can't access anything. ((.sh.value = ++_.y)) } ) Type obj print -r ${obj.x} ${obj.x} # prints 1 2 The above should be equivalent to the follwing Python code: #!/usr/bin/env python3 class Type(object): def __init__(self): self.y = 5 @property def x(self): self.y += 1 return self.y obj = Type() print(obj.x, obj.x) # prints 6 7 Or the following C# code: using System; namespace Program { public class Type { private int y = 5; public string x { get { y++; return this.y.ToString(); } } } public class Program { static int Main(string[] argv) { var obj = new Type(); Console.WriteLine({0} {1}, obj.x, obj.x); // prints 6 7 return 0; } } } -- Dan Douglas I think that python has this right. This should prnt 6 7. I will modify _ so that for types subvariables, it will reference the type. This way neither _._ or __ is needed. David Korn d...@research.att.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] _ doesn't refer to the correct object.
On 24 July 2013 18:04, David Korn d...@research.att.com wrote: cc: orm...@gmail.com Subject: Re: [ast-users] _ doesn't refer to the correct object. In this type, I can't think of any way to refer to obj from within x.get. _ should point to obj in this context, not obj.x. #!/usr/bin/env ksh typeset -T Type=( typeset -h 'This will be a property.' x integer -h 'This will be the backing field for x.' y=5 function x.get { # Huge problem here because _ refers to x, # we can't access anything. ((.sh.value = ++_.y)) } ) Type obj print -r ${obj.x} ${obj.x} # prints 1 2 The above should be equivalent to the follwing Python code: #!/usr/bin/env python3 class Type(object): def __init__(self): self.y = 5 @property def x(self): self.y += 1 return self.y obj = Type() print(obj.x, obj.x) # prints 6 7 Or the following C# code: using System; namespace Program { public class Type { private int y = 5; public string x { get { y++; return this.y.ToString(); } } } public class Program { static int Main(string[] argv) { var obj = new Type(); Console.WriteLine({0} {1}, obj.x, obj.x); // prints 6 7 return 0; } } } -- Dan Douglas I think that python has this right. This should prnt 6 7. I will modify _ so that for types subvariables, it will reference the type. This way neither _._ or __ is needed. *protest* var.__ has a different use case. var.__ is to access the parent of a variable in a variable tree, let it be a compound variable or nested type variables. Ced -- Cedric Blancher cedric.blanc...@gmail.com Institute Pasteur ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] _ doesn't refer to the correct object.
On 24 July 2013 18:04, David Korn d...@research.att.com wrote: cc: orm...@gmail.com Subject: Re: [ast-users] _ doesn't refer to the correct object. In this type, I can't think of any way to refer to obj from within x.get. _ should point to obj in this context, not obj.x. #!/usr/bin/env ksh typeset -T Type=( typeset -h 'This will be a property.' x integer -h 'This will be the backing field for x.' y=5 function x.get { # Huge problem here because _ refers to x, # we can't access anything. ((.sh.value = ++_.y)) } ) Type obj print -r ${obj.x} ${obj.x} # prints 1 2 The above should be equivalent to the follwing Python code: #!/usr/bin/env python3 class Type(object): def __init__(self): self.y = 5 @property def x(self): self.y += 1 return self.y obj = Type() print(obj.x, obj.x) # prints 6 7 Or the following C# code: using System; namespace Program { public class Type { private int y = 5; public string x { get { y++; return this.y.ToString(); } } } public class Program { static int Main(string[] argv) { var obj = new Type(); Console.WriteLine({0} {1}, obj.x, obj.x); // prints 6 7 return 0; } } } -- Dan Douglas I think that python has this right. This should prnt 6 7. I will modify _ so that for types subvariables, it will reference the type. What happens if x itself is a typed variable? What does python do? Ced -- Cedric Blancher cedric.blanc...@gmail.com Institute Pasteur ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] _ doesn't refer to the correct object.
cc: ast-users@lists.research.att.com orm...@gmail.com Subject: Re: Re: [ast-users] _ doesn't refer to the correct object. What happens if x itself is a typed variable? What does python do? I don't know what python does. What I did for ksh was to have _ reference x when x is a type variable. David Korn d...@research.att.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] ACL lists not preserved when copying files with ksh cp
On 23 July 2013 20:43, Glenn Fowler g...@research.att.com wrote: On Tue, 23 Jul 2013 19:16:43 +0200 Tina Harriott wrote: I hope this is the right place to report to. On Suse Linux nfs4 ACL lists are not preserved if I copy files with ksh's builtin cp command. To demonstrate: 1. touch aaa 2. nfs4_setfacl -a A::testuser@localdomain:RX aaa 3. nfs4_getfacl aaa D::OWNER@:x A::OWNER@:rwatTcCy A::1000:rxtcy - new ACL entry A::GROUP@:rtcy A::EVERYONE@:rtcy 4. ksh -c 'builtin cp; cp aaa aaa_copy' 5. nfs4_getfacl aaa_copy D::OWNER@:x A::OWNER@:rwatTcCy A::GROUP@:rxtcy A::EVERYONE@:rtcy The new ACL entry is missing in the copy. cp options -a and -p have no effect. Is this functionality missing or just broken. ACL support is IMO a mandatory enterprise system feature and needs to be supported. missing on the todo list How long will it take to implement it? Tina -- Tina Harriott - Women in Mathematics Contact: tina.harriott.mathemat...@gmail.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
[ast-users] Demo code and contrib packages?
Does ast-ksh have extension packages like demo and contrib like bash and zsh do? Tina -- Tina Harriott - Women in Mathematics Contact: tina.harriott.mathemat...@gmail.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
[ast-users] Unit of least precision (ULP)/spacing between floating point number problems
Here's one of my little tough problems which I am unable to solve myself, even after looking at the source code of ast-ksh. The problem below requires a good understanding how floating point numbers are implemented in computers. I'm trying to prototype code and like to iterate over a small, linear area by using the C library function nextafter() to step forward the smallest possible distance between each step, and print the number of iterations needed to cover the distance between 4 and 4.0001: ksh -c 'float v ; integer iter ; for ((iter=0,v=4 ; v 4.0001 iter 1000; v=nextafter(v,4.0001))) ; do ((iter++));done;print $iter ' 2305843 The result 2305843 is correct. However, if I use typeset -E (or just typeset) to declare the variable v the loop runs forever, or in this case until it hits iter 1000 which I added as safeguard later: ksh -c 'typeset -E v ; integer iter ; for ((iter=0,v=4 ; v 4.0001 iter 1000; v=nextafter(v,4.0001))) ; do ((iter++));done;print $iter ' 1000 Can anyone explain this? Tina -- Tina Harriott - Women in Mathematics Contact: tina.harriott.mathemat...@gmail.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] Unit of least precision (ULP)/spacing between floating point number problems
On Wed, 24 Jul 2013 19:02:39 +0200 Tina Harriott wrote: Here's one of my little tough problems which I am unable to solve myself, even after looking at the source code of ast-ksh. The problem below requires a good understanding how floating point numbers are implemented in computers. I'm trying to prototype code and like to iterate over a small, linear area by using the C library function nextafter() to step forward the smallest possible distance between each step, and print the number of iterations needed to cover the distance between 4 and 4.0001: ksh -c 'float v ; integer iter ; for ((iter=0,v=4 ; v 4.0001 iter 1000; v=nextafter(v,4.0001))) ; do ((iter++));done;print $iter ' 2305843 The result 2305843 is correct. However, if I use typeset -E (or just typeset) to declare the variable v the loop runs forever, or in this case until it hits iter 1000 which I added as safeguard later: ksh -c 'typeset -E v ; integer iter ; for ((iter=0,v=4 ; v 4.0001 iter 1000; v=nextafter(v,4.0001))) ; do ((iter++));done;print $iter ' 1000 Can anyone explain this? float is an alias this shows the alias definition type float which is typeset -lE this documents -l typeset --?l so for your example typeset -E gave you a double v and typeset -lE would give you a long double v ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] Demo code and contrib packages?
On Wed, 24 Jul 2013 18:52:14 +0200 Tina Harriott wrote: Does ast-ksh have extension packages like demo and contrib like bash and zsh do? in ksh user extension are called builtins and have an main(argc,argv,context) api its described in the nav bar at http://www.research.att.com/sw/download/ AST = ksh = builtins ksh has some builtins implemented directly in its source there and many other ast builtins implemented in src/lib/libcmd ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] ACL lists not preserved when copying files with ksh cp
On Wed, 24 Jul 2013 18:52:57 +0200 Tina Harriott wrote: On 23 July 2013 20:43, Glenn Fowler g...@research.att.com wrote: On Tue, 23 Jul 2013 19:16:43 +0200 Tina Harriott wrote: I hope this is the right place to report to. On Suse Linux nfs4 ACL lists are not preserved if I copy files with ksh's builtin cp command. To demonstrate: 1. touch aaa 2. nfs4_setfacl -a A::testuser@localdomain:RX aaa 3. nfs4_getfacl aaa D::OWNER@:x A::OWNER@:rwatTcCy A::1000:rxtcy - new ACL entry A::GROUP@:rtcy A::EVERYONE@:rtcy 4. ksh -c 'builtin cp; cp aaa aaa_copy' 5. nfs4_getfacl aaa_copy D::OWNER@:x A::OWNER@:rwatTcCy A::GROUP@:rxtcy A::EVERYONE@:rtcy The new ACL entry is missing in the copy. cp options -a and -p have no effect. Is this functionality missing or just broken. ACL support is IMO a mandatory enterprise system feature and needs to be supported. missing on the todo list How long will it take to implement it? acls have always been a portability sore point we avoided doing anything because no-one has presented an api that handles all our needs across varying architectures/implementations in particular we need an api that converts a string rep to binary converts a binary rep to string applies a binary acl to a file/fd retrives a binary acl from a file/fd I don't use acls because whenever they have been forced on me I manage to get painted into all sorts of corners that prevent work at inopportune times a thing I really don't like is they bleed into non-acl apis/commands in strange ways should ls/chown/chmod/mv/ln grok acls? what about other commands/apis that copy files and don't use cp(1) or pax(1)? how much stuff needs to be added around each open(O_CREAT) to make acls seamless? is there an acl equivalent to umask(1)/umask(2)? ast encompasses a lot of apis/commands the main reason behind doing it in the first place is uniform semantics across all of ast I don't see uniformity in acls at the moment but I can be convinced ... ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] _ doesn't refer to the correct object.
On Wed, Jul 24, 2013 at 6:08 PM, Cedric Blancher cedric.blanc...@gmail.com wrote: On 24 July 2013 18:04, David Korn d...@research.att.com wrote: cc: orm...@gmail.com Subject: Re: [ast-users] _ doesn't refer to the correct object. In this type, I can't think of any way to refer to obj from within x.get. _ should point to obj in this context, not obj.x. #!/usr/bin/env ksh typeset -T Type=( typeset -h 'This will be a property.' x integer -h 'This will be the backing field for x.' y=5 function x.get { # Huge problem here because _ refers to x, # we can't access anything. ((.sh.value = ++_.y)) } ) Type obj print -r ${obj.x} ${obj.x} # prints 1 2 The above should be equivalent to the follwing Python code: #!/usr/bin/env python3 class Type(object): def __init__(self): self.y = 5 @property def x(self): self.y += 1 return self.y obj = Type() print(obj.x, obj.x) # prints 6 7 Or the following C# code: using System; namespace Program { public class Type { private int y = 5; public string x { get { y++; return this.y.ToString(); } } } public class Program { static int Main(string[] argv) { var obj = new Type(); Console.WriteLine({0} {1}, obj.x, obj.x); // prints 6 7 return 0; } } } -- Dan Douglas I think that python has this right. This should prnt 6 7. I will modify _ so that for types subvariables, it will reference the type. This way neither _._ or __ is needed. *protest* Please move the discussion into a different mail thread. Otherwise this idea gets sunk by the other issue (a, a.x vs _) here. var.__ has a different use case. var.__ is to access the parent of a variable in a variable tree, let it be a compound variable or nested type variables. +1 I agree that var.__ is a novel idea which solves a lot of problems for languages which do not have something like C++ pointers. Irek ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] Demo code and contrib packages?
On 24 July 2013 19:32, Glenn Fowler g...@research.att.com wrote: On Wed, 24 Jul 2013 18:52:14 +0200 Tina Harriott wrote: Does ast-ksh have extension packages like demo and contrib like bash and zsh do? in ksh user extension are called builtins and have an main(argc,argv,context) api its described in the nav bar at http://www.research.att.com/sw/download/ AST = ksh = builtins ksh has some builtins implemented directly in its source there and many other ast builtins implemented in src/lib/libcmd I think you misunderstood the question. For example, bash provides demo and contrib packages. Demo contains demo scripts to show the various features of a shell, and contrib contains extra functionality written by people who are not in the core development team but are otherwise thought to be useful. Tina -- Tina Harriott - Women in Mathematics Contact: tina.harriott.mathemat...@gmail.com ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users
Re: [ast-users] Demo code and contrib packages?
On Wed, 24 Jul 2013 22:15:01 +0200 Tina Harriott wrote: On 24 July 2013 19:32, Glenn Fowler g...@research.att.com wrote: On Wed, 24 Jul 2013 18:52:14 +0200 Tina Harriott wrote: Does ast-ksh have extension packages like demo and contrib like bash and zsh do? in ksh user extension are called builtins and have an main(argc,argv,context) api its described in the nav bar at http://www.research.att.com/sw/download/ AST = ksh = builtins ksh has some builtins implemented directly in its source there and many other ast builtins implemented in src/lib/libcmd I think you misunderstood the question. For example, bash provides demo and contrib packages. Demo contains demo scripts to show the various features of a shell, and contrib contains extra functionality written by people who are not in the core development team but are otherwise thought to be useful. yes I did misunderstand currently no demo or contrib packages ___ ast-users mailing list ast-users@lists.research.att.com http://lists.research.att.com/mailman/listinfo/ast-users